From fc0b8aac9d5f1f77aa9a412fa5da2cc6b1a984ae Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Nov 2014 08:35:06 -0800 Subject: [PATCH] token_group: Use samba.tests.subunitrun. Change-Id: Id7c247451532eded1f44ef9b1aa1808dd18098c6 Signed-off-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett --- source4/dsdb/tests/python/token_group.py | 20 ++++++++------------ source4/selftest/tests.py | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/source4/dsdb/tests/python/token_group.py b/source4/dsdb/tests/python/token_group.py index ff9f3ecbaa8..94a45b1810f 100755 --- a/source4/dsdb/tests/python/token_group.py +++ b/source4/dsdb/tests/python/token_group.py @@ -8,8 +8,8 @@ import os 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 @@ -21,8 +21,6 @@ from samba.ndr import ndr_unpack from samba import gensec from samba.credentials import Credentials -from subunit.run import SubunitTestRunner -import unittest import samba.tests from samba.auth import AUTH_SESSION_INFO_DEFAULT_GROUPS, AUTH_SESSION_INFO_AUTHENTICATED, AUTH_SESSION_INFO_SIMPLE_PRIVILEGES @@ -35,6 +33,8 @@ 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: @@ -106,7 +106,7 @@ class TokenTest(samba.tests.TestCase): print("token sids don't match") print("difference : %s" % sidset1.difference(sidset2)) self.fail(msg="calculated groups don't match against user DN tokenGroups") - + def test_pac_groups(self): settings = {} settings["lp_ctx"] = lp @@ -131,8 +131,8 @@ class TokenTest(samba.tests.TestCase): client_finished = False server_finished = False server_to_client = "" - - """Run the actual call loop""" + + # Run the actual call loop. while client_finished == False and server_finished == False: if not client_finished: print "running client gensec_update" @@ -164,8 +164,4 @@ if not "://" in url: samdb = SamDB(url, credentials=creds, session_info=system_session(lp), lp=lp) -runner = SubunitTestRunner() -rc = 0 -if not runner.run(unittest.makeSuite(TokenTest)).wasSuccessful(): - rc = 1 -sys.exit(rc) +TestProgram(module=__name__, opts=subunitopts) diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 33603d858e9..bad370d7fdc 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -462,8 +462,8 @@ planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho") planoldpythontestsuite("dc:local", "samba.tests.dcerpc.registry", extra_args=['-U"$USERNAME%$PASSWORD"']) planoldpythontestsuite("dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"']) planoldpythontestsuite("plugin_s4_dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"']) -plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) -plantestsuite("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) +plantestsuite_loadlist("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT']) +plantestsuite_loadlist("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT']) plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) planoldpythontestsuite("dc", "dsdb_schema_info", extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')], -- 2.11.4.GIT