summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-19 17:49:46 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-19 22:46:44 +0200
commit50429fb75074863598807267a6d02ed44056efe8 (patch)
treede49161f6f3c21a48899a0dfb6c5bddee7676052
parentf57b26b6f44494efc0689724a33780e660e3d795 (diff)
downloadsamba-50429fb75074863598807267a6d02ed44056efe8.tar.gz
samba-50429fb75074863598807267a6d02ed44056efe8.tar.bz2
samba-50429fb75074863598807267a6d02ed44056efe8.zip
samba.tests.samba3: Clean up imports, use new TestCase class.
-rw-r--r--source4/scripting/python/samba/tests/samba3.py51
1 files changed, 38 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py
index 12b9a8325d..d7418b303d 100644
--- a/source4/scripting/python/samba/tests/samba3.py
+++ b/source4/scripting/python/samba/tests/samba3.py
@@ -17,16 +17,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import unittest
-from samba.samba3 import GroupMappingDatabase, Registry, PolicyDatabase, SecretsDatabase, TdbSam
-from samba.samba3 import WinsDatabase, SmbpasswdFile, ACB_NORMAL, IdmapDatabase, SAMUser, ParamFile
+from samba.samba3 import (GroupMappingDatabase, Registry, PolicyDatabase,
+ SecretsDatabase, TdbSam)
+from samba.samba3 import (WinsDatabase, SmbpasswdFile, ACB_NORMAL,
+ IdmapDatabase, SAMUser, ParamFile)
+from samba.tests import TestCase
import os
DATADIR=os.path.join(os.path.dirname(__file__), "../../../../../testdata/samba3")
print "Samba 3 data dir: %s" % DATADIR
-class RegistryTestCase(unittest.TestCase):
+class RegistryTestCase(TestCase):
+
def setUp(self):
+ super(RegistryTestCase, self).setUp()
self.registry = Registry(os.path.join(DATADIR, "registry.tdb"))
def tearDown(self):
@@ -47,8 +51,10 @@ class RegistryTestCase(unittest.TestCase):
self.registry.values("HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/EVENTLOG"))
-class PolicyTestCase(unittest.TestCase):
+class PolicyTestCase(TestCase):
+
def setUp(self):
+ super(PolicyTestCase, self).setUp()
self.policy = PolicyDatabase(os.path.join(DATADIR, "account_policy.tdb"))
def test_policy(self):
@@ -64,12 +70,15 @@ class PolicyTestCase(unittest.TestCase):
self.assertEquals(self.policy.bad_lockout_minutes, None)
-class GroupsTestCase(unittest.TestCase):
+class GroupsTestCase(TestCase):
+
def setUp(self):
+ super(GroupsTestCase, self).setUp()
self.groupdb = GroupMappingDatabase(os.path.join(DATADIR, "group_mapping.tdb"))
def tearDown(self):
self.groupdb.close()
+ super(GroupsTestCase, self).tearDown()
def test_group_length(self):
self.assertEquals(13, len(list(self.groupdb.groupsids())))
@@ -85,23 +94,29 @@ class GroupsTestCase(unittest.TestCase):
self.assertEquals(0, len(list(self.groupdb.aliases())))
-class SecretsDbTestCase(unittest.TestCase):
+class SecretsDbTestCase(TestCase):
+
def setUp(self):
+ super(SecretsDbTestCase, self).setUp()
self.secretsdb = SecretsDatabase(os.path.join(DATADIR, "secrets.tdb"))
def tearDown(self):
self.secretsdb.close()
+ super(SecretsDbTestCase, self).tearDown()
def test_get_sid(self):
self.assertTrue(self.secretsdb.get_sid("BEDWYR") is not None)
-class TdbSamTestCase(unittest.TestCase):
+class TdbSamTestCase(TestCase):
+
def setUp(self):
+ super(TdbSamTestCase, self).setUp()
self.samdb = TdbSam(os.path.join(DATADIR, "passdb.tdb"))
def tearDown(self):
self.samdb.close()
+ super(TdbSamTestCase, self).tearDown()
def test_usernames(self):
self.assertEquals(3, len(list(self.samdb.usernames())))
@@ -140,8 +155,10 @@ class TdbSamTestCase(unittest.TestCase):
self.assertEquals(user, other)
-class WinsDatabaseTestCase(unittest.TestCase):
+class WinsDatabaseTestCase(TestCase):
+
def setUp(self):
+ super(WinsDatabaseTestCase, self).setUp()
self.winsdb = WinsDatabase(os.path.join(DATADIR, "wins.dat"))
def test_length(self):
@@ -152,10 +169,13 @@ class WinsDatabaseTestCase(unittest.TestCase):
def tearDown(self):
self.winsdb.close()
+ super(WinsDatabaseTestCase, self).tearDown()
-class SmbpasswdTestCase(unittest.TestCase):
+class SmbpasswdTestCase(TestCase):
+
def setUp(self):
+ super(SmbpasswdTestCase, self).setUp()
self.samdb = SmbpasswdFile(os.path.join(DATADIR, "smbpasswd"))
def test_length(self):
@@ -172,11 +192,15 @@ class SmbpasswdTestCase(unittest.TestCase):
def tearDown(self):
self.samdb.close()
+ super(SmbpasswdTestCase, self).tearDown()
+
+class IdmapDbTestCase(TestCase):
-class IdmapDbTestCase(unittest.TestCase):
def setUp(self):
- self.idmapdb = IdmapDatabase(os.path.join(DATADIR, "winbindd_idmap.tdb"))
+ super(IdmapDbTestCase, self).setUp()
+ self.idmapdb = IdmapDatabase(os.path.join(DATADIR,
+ "winbindd_idmap.tdb"))
def test_user_hwm(self):
self.assertEquals(10000, self.idmapdb.get_user_hwm())
@@ -198,9 +222,10 @@ class IdmapDbTestCase(unittest.TestCase):
def tearDown(self):
self.idmapdb.close()
+ super(IdmapDbTestCase, self).tearDown()
-class ParamTestCase(unittest.TestCase):
+class ParamTestCase(TestCase):
def test_init(self):
file = ParamFile()