summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-11-01 20:27:30 -0700
committerJelmer Vernooij <jelmer@samba.org>2014-11-19 18:30:06 +0100
commit7f0969d79a45c7ae4c62a319889680bf3117b71c (patch)
tree6d5cb255442faa19b63ea0982e14677f010e7769
parenta214bf6fb1a43be98e2a3354a4785053996e4ee0 (diff)
downloadsamba-7f0969d79a45c7ae4c62a319889680bf3117b71c.tar.gz
samba-7f0969d79a45c7ae4c62a319889680bf3117b71c.tar.xz
samba-7f0969d79a45c7ae4c62a319889680bf3117b71c.zip
dirsync test: Create and run a single testsuite, should easy migration to regulary Python unit tests.
Change-Id: I6fbffd6453f8af966938943f2895bd6d93f8fb59 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-xsource4/dsdb/tests/python/dirsync.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py
index f36a3c0d2c..14810d3631 100755
--- a/source4/dsdb/tests/python/dirsync.py
+++ b/source4/dsdb/tests/python/dirsync.py
@@ -77,12 +77,12 @@ class DirsyncBaseTests(samba.tests.TestCase):
def setUp(self):
super(DirsyncBaseTests, self).setUp()
- self.ldb_admin = ldb
- self.base_dn = ldb.domain_dn()
- self.domain_sid = security.dom_sid(ldb.get_domain_sid())
+ self.ldb_admin = SamDB(ldapshost, credentials=creds, session_info=system_session(lp), lp=lp)
+ self.base_dn = self.ldb_admin.domain_dn()
+ self.domain_sid = security.dom_sid(self.ldb_admin.get_domain_sid())
self.user_pass = "samba123@AAA"
self.configuration_dn = self.ldb_admin.get_config_basedn().get_linearized()
- self.sd_utils = sd_utils.SDUtils(ldb)
+ self.sd_utils = sd_utils.SDUtils(self.ldb_admin)
#used for anonymous login
print "baseDN: %s" % self.base_dn
@@ -142,7 +142,6 @@ class SimpleDirsyncTests(DirsyncBaseTests):
#def test_dirsync_errors(self):
-
def test_dirsync_supported(self):
"""Test the basic of the dirsync is supported"""
self.ldb_dirsync = self.get_ldb_connection(self.dirsync_user, self.user_pass)
@@ -222,9 +221,6 @@ class SimpleDirsyncTests(DirsyncBaseTests):
print l
self.assertTrue(str(l).find("LDAP_UNWILLING_TO_PERFORM") != -1)
-
-
-
def test_dirsync_attributes(self):
"""Check behavior with some attributes """
res = self.ldb_admin.search(self.base_dn,
@@ -590,7 +586,9 @@ class SimpleDirsyncTests(DirsyncBaseTests):
expression="(&(objectClass=organizationalUnit)(!(isDeleted=*)))",
controls=controls)
+
class ExtendedDirsyncTests(SimpleDirsyncTests):
+
def test_dirsync_linkedattributes(self):
flag_incr_linked = 2147483648
self.ldb_simple = self.get_ldb_connection(self.simple_user, self.user_pass)
@@ -698,14 +696,13 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
self.assertEqual(str(res[0].dn), "")
-ldb = SamDB(ldapshost, credentials=creds, session_info=system_session(lp), lp=lp)
-
runner = SubunitTestRunner()
-rc = 0
-#
-if not runner.run(unittest.makeSuite(SimpleDirsyncTests)).wasSuccessful():
- rc = 1
-if not runner.run(unittest.makeSuite(ExtendedDirsyncTests)).wasSuccessful():
+suite = unittest.TestSuite()
+suite.addTests(unittest.makeSuite(SimpleDirsyncTests))
+suite.addTests(unittest.makeSuite(ExtendedDirsyncTests))
+if not runner.run(suite).wasSuccessful():
rc = 1
+else:
+ rc = 0
sys.exit(rc)