bioweb  0.09.92
C++/Python(django)/JavaScript(angularJS) framework
tests.py
Go to the documentation of this file.
1 ## @file version/tests.py
2 # @brief version module unit testing
3 
4 import datetime
5 import django.test
6 import models
7 import views
8 
9 class VersionModelTestCase(django.test.TestCase):
10  """test version model"""
11 
13  """test if getVersion return non-empty string"""
14  self.assertTrue( len(models.getVersionString()) > 0 )
15 
16  def test02getDBName(self):
17  """test if getDBName return non-empty string"""
18  self.assertTrue( len(models.getDBName()) > 0)
19 
20  def test03getDBUser(self):
21  """test if getDBUser return non-empty string"""
22  self.assertTrue( len(models.getDBUser()) > 0)
23 
25  """test if getDBPassword return non-empty string"""
26  self.assertTrue( len(models.getDBPassword()) > 0)
27 
29  """test if getDBPassword return any output"""
30  v = models.getDBVersionString()
31  self.assertTrue( len(v) > 0)
32  self.assertNotEqual( str(v), 'unknown' )
33 
35  """check if database version string has 'ver'"""
36  self.assertEqual( models._versionFromRow(''), 'unknown' )
37  t = ('ver,xxx',)
38  self.assertEqual( models._versionFromRow(t), 'ver')
39 
40 class VersionViewTestCase(django.test.TestCase):
41  """test version interface"""
42 
43  def test01get(self):
44  """check if get service return non-empty dict"""
45  d = views.get({})
46  self.assertEqual( len(d), 3)
47 
48 
49