summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2017-06-09 14:52:59 +0200
committerStefan Metzmacher <metze@samba.org>2017-06-13 22:46:14 +0200
commit0eb99bd9884c6dc0073fe4ab9074b99519c2594e (patch)
tree565b541cd5a2b81faca2129ae0b9836c0985a046 /python
parentba4cabb74f9abf834ee50364fba98ba8c3e9dee3 (diff)
downloadsamba-0eb99bd9884c6dc0073fe4ab9074b99519c2594e.tar.gz
python/samba/tests: don't use hardcoded names in *pam_winbind* tests
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/pam_winbind.py15
-rwxr-xr-xpython/samba/tests/test_pam_winbind.sh8
2 files changed, 19 insertions, 4 deletions
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"