ldap: Use samba.tests.subunitrun.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2014 17:44:05 +0000 (09:44 -0800)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 22 Nov 2014 01:23:10 +0000 (02:23 +0100)
Change-Id: I872654afb31a5eda8c88aac716f9ce79816e5f05
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/acl.py
source4/selftest/tests.py

index 7ef9ad9e4e67ad624bbfa5cb3243251712cf6899..4acc12349f41e1a2408b8d847dbb68146b1fc080 100755 (executable)
@@ -8,8 +8,8 @@ import base64
 import re
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
+
+from samba.tests.subunitrun import SubunitOptions, TestProgram
 
 import samba.getopt as options
 from samba.join import dc_join
@@ -29,8 +29,6 @@ from samba.samdb import SamDB
 from samba.credentials import Credentials, DONT_USE_KERBEROS
 import samba.tests
 from samba.tests import delete_force
-from subunit.run import SubunitTestRunner
-import unittest
 import samba.dsdb
 
 parser = optparse.OptionParser("acl.py [options] <host>")
@@ -41,6 +39,9 @@ parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
+
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -1902,18 +1903,4 @@ class AclSPNTests(AclTests):
 
 ldb = SamDB(ldaphost, credentials=creds, session_info=system_session(lp), lp=lp)
 
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(AclAddTests))
-suite.addTests(unittest.makeSuite(AclModifyTests))
-suite.addTests(unittest.makeSuite(AclDeleteTests))
-suite.addTests(unittest.makeSuite(AclRenameTests))
-suite.addTests(unittest.makeSuite(AclCARTests))
-suite.addTests(unittest.makeSuite(AclSearchTests))
-suite.addTests(unittest.makeSuite(AclExtendedTests))
-suite.addTests(unittest.makeSuite(AclSPNTests))
-if not runner.run(suite).wasSuccessful():
-    rc = 1
-else:
-    rc = 0
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
index e1652bc572368901514b87ee101ebbcc7328aaeb..ef0d853584ead340fa20972752c1d527b95fd775 100755 (executable)
@@ -476,7 +476,7 @@ for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
     plantestsuite_loadlist("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
     plantestsuite("samba4.ldap.possibleInferiors.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/samdb/ldb_modules/tests/possibleinferiors.py"), "ldap://$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN"])
     plantestsuite_loadlist("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
-    plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
+    plantestsuite_loadlist("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
     if env != "fl2000dc":
         # This test makes excessive use of the "userPassword" attribute which
         # isn't available on DCs with Windows 2000 domain function level -