2005-03-17 22:29:08 +01:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
import common, unittest
|
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
class mdbTest(TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
import mdb
|
|
|
|
self.mdb = mdb
|
|
|
|
|
|
|
|
|
|
|
|
class connectTest(mdbTest):
|
|
|
|
|
2005-03-18 00:42:28 +01:00
|
|
|
def test_0(self):
|
2005-05-27 15:09:30 +02:00
|
|
|
db = self.mdb.connect("inputs/db-legal-00/")
|
2005-03-17 22:29:08 +01:00
|
|
|
self.failUnless(db.__class__ == self.mdb.db.PVVDB)
|
|
|
|
|
|
|
|
|
|
|
|
class disconnectTest(mdbTest):
|
|
|
|
|
2005-03-18 00:42:28 +01:00
|
|
|
def test_0(self):
|
2005-05-27 15:09:30 +02:00
|
|
|
db = self.mdb.connect("inputs/db-legal-00/")
|
2005-03-17 22:29:08 +01:00
|
|
|
self.mdb.disconnect(db)
|
|
|
|
|
2005-03-18 00:42:28 +01:00
|
|
|
|
|
|
|
class formatTest(mdbTest):
|
|
|
|
|
|
|
|
def test_0(self):
|
2005-05-27 15:09:30 +02:00
|
|
|
db = self.mdb.connect("inputs/db-legal-00/")
|
2005-03-18 00:42:28 +01:00
|
|
|
format = db._PVVDB__format("inputs/format-legal-00")
|
|
|
|
self.failUnless(format['username'] == 'scalar' and
|
|
|
|
format['realname'] == 'scalar' and
|
|
|
|
format['uid'] == 'scalar' and
|
|
|
|
format['disk'] == 'list' and
|
|
|
|
format['bdb-uid'] == 'scalar' and
|
|
|
|
format['bdb-username'] == 'scalar' and
|
|
|
|
format['purged'] == 'scalar' and
|
|
|
|
format['membership'] == 'list')
|
|
|
|
|
2005-05-27 15:09:30 +02:00
|
|
|
class loadTest(mdbTest):
|
|
|
|
|
|
|
|
def test_0(self):
|
|
|
|
db = self.mdb.connect("inputs/db-legal-00/")
|
|
|
|
user = db.load("user1")
|
|
|
|
self.failUnless(user)
|
2005-03-18 00:42:28 +01:00
|
|
|
|
2005-03-17 22:29:08 +01:00
|
|
|
#
|
|
|
|
# Run the library tests.
|
|
|
|
#
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|