From: Stefan Metzmacher Date: Fri, 9 Jun 2017 12:52:59 +0000 (+0200) Subject: python/samba/tests: don't use hardcoded names in *pam_winbind* tests X-Git-Tag: ldb-1.1.31~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eb99bd9884c6dc0073fe4ab9074b99519c2594e;p=thirdparty%2Fsamba.git python/samba/tests: don't use hardcoded names in *pam_winbind* tests Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/python/samba/tests/pam_winbind.py b/python/samba/tests/pam_winbind.py index 21ea2fbed7e..1054e86dc9d 100644 --- a/python/samba/tests/pam_winbind.py +++ b/python/samba/tests/pam_winbind.py @@ -18,22 +18,29 @@ import samba.tests import pypamtest +import os class SimplePamTests(samba.tests.TestCase): def test_authenticate(self): - alice_password = "Secret007" + domain = os.environ["DOMAIN"] + username = os.environ["USERNAME"] + password = os.environ["PASSWORD"] + unix_username = "%s/%s" % (domain, username) expected_rc = 0 # PAM_SUCCESS tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc) - res = pypamtest.run_pamtest("SAMBADOMAIN/alice", "samba", [tc], [alice_password]) + res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password]) self.assertTrue(res != None) def test_authenticate_error(self): - alice_password = "WrongPassword" + domain = os.environ["DOMAIN"] + username = os.environ["USERNAME"] + password = "WrongPassword" + unix_username = "%s/%s" % (domain, username) expected_rc = 7 # PAM_AUTH_ERR tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc) - res = pypamtest.run_pamtest("SAMBADOMAIN/alice", "samba", [tc], [alice_password]) + res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password]) self.assertTrue(res != None) diff --git a/python/samba/tests/test_pam_winbind.sh b/python/samba/tests/test_pam_winbind.sh index bf59296b732..fdd2870dff4 100755 --- a/python/samba/tests/test_pam_winbind.sh +++ b/python/samba/tests/test_pam_winbind.sh @@ -4,6 +4,14 @@ PYTHON="$1" PAM_WRAPPER_SO_PATH="$2" shift 2 +DOMAIN="$1" +export DOMAIN +USERNAME="$2" +export USERNAME +PASSWORD="$3" +export PASSWORD +shift 3 + PAM_WRAPPER_PATH="$BINDIR/default/lib/pam_wrapper" pam_winbind="$BINDIR/shared/pam_winbind.so" diff --git a/selftest/tests.py b/selftest/tests.py index 5367fe35936..9033dd9a9a0 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -140,7 +140,8 @@ planpythontestsuite("none", "samba.tests.glue", py3_compatible=True) if with_pam: plantestsuite("samba.tests.pam_winbind", "ad_member", - [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"), valgrindify(python), pam_wrapper_so_path]) + [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"), + valgrindify(python), pam_wrapper_so_path, "$DOMAIN", "alice", "Secret007"]) if with_cmocka: plantestsuite("samba.unittests.krb5samba", "none",