summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-11-02 08:57:37 -0800
committerJelmer Vernooij <jelmer@samba.org>2014-11-22 02:23:10 +0100
commit0c82bdda0fddab4aa6bdbbbe13b6f888ed1c2c67 (patch)
tree3421f3ec4b9066191f5a6a053fbd4ebee1c3459f
parentfc0b8aac9d5f1f77aa9a412fa5da2cc6b1a984ae (diff)
downloadsamba-0c82bdda0fddab4aa6bdbbbe13b6f888ed1c2c67.tar.gz
samba-0c82bdda0fddab4aa6bdbbbe13b6f888ed1c2c67.tar.xz
samba-0c82bdda0fddab4aa6bdbbbe13b6f888ed1c2c67.zip
sec_descriptor: Use samba.tests.subunitrun.
Change-Id: I5caba3e27ad21cc5381883a823e0ec5e2966a264 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-xsource4/dsdb/tests/python/sec_descriptor.py22
-rwxr-xr-xsource4/selftest/tests.py2
2 files changed, 7 insertions, 17 deletions
diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py
index 39b5d4e569..321d1288cc 100755
--- a/source4/dsdb/tests/python/sec_descriptor.py
+++ b/source4/dsdb/tests/python/sec_descriptor.py
@@ -10,8 +10,8 @@ import random
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
@@ -29,10 +29,8 @@ from samba.auth import system_session
from samba.dsdb import DS_DOMAIN_FUNCTION_2008
from samba.dcerpc.security import (
SECINFO_OWNER, SECINFO_GROUP, SECINFO_DACL, SECINFO_SACL)
-from subunit.run import SubunitTestRunner
import samba.tests
from samba.tests import delete_force
-import unittest
parser = optparse.OptionParser("sec_descriptor.py [options] <host>")
sambaopts = options.SambaOptions(parser)
@@ -42,6 +40,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:
@@ -2174,15 +2175,4 @@ if not "://" in host:
if host.lower().startswith("ldap://"):
ldb_options = ["modules:paged_searches"]
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(OwnerGroupDescriptorTests))
-suite.addTests(unittest.makeSuite(DaclDescriptorTests))
-suite.addTests(unittest.makeSuite(SdFlagsDescriptorTests))
-suite.addTests(unittest.makeSuite(RightsAttributesTests))
-suite.addTests(unittest.makeSuite(SdAutoInheritTests))
-if not runner.run(suite).wasSuccessful():
- rc = 1
-else:
- rc = 0
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index bad370d7fd..488cd6f1ea 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -475,7 +475,7 @@ plantestsuite_loadlist("samba4.ldap.sites.python(dc)", "dc", [python, os.path.jo
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("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$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'])
if env != "fl2000dc":
# This test makes excessive use of the "userPassword" attribute which