aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-03-24 08:37:24 +0100
committerAndreas Schneider <asn@samba.org>2020-03-24 08:38:02 +0100
commitffca0103fceb9d283eb36f175cb76597183de255 (patch)
tree2bc7b61310101ee37849ad11ada7e23f3673b3a9
parent36fe0f34041ba04f5cfe2f39ee28ebcb7cda3ca6 (diff)
downloadpam_wrapper-ffca0103fceb9d283eb36f175cb76597183de255.tar.gz
pam_wrapper-ffca0103fceb9d283eb36f175cb76597183de255.tar.xz
pam_wrapper-ffca0103fceb9d283eb36f175cb76597183de255.zip
tests: Define PAM_AUTH_ERROR in init function
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rwxr-xr-xtests/pypamtest_test.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/pypamtest_test.py b/tests/pypamtest_test.py
index 8461735..d49a110 100755
--- a/tests/pypamtest_test.py
+++ b/tests/pypamtest_test.py
@@ -103,6 +103,13 @@ class PyPamTestTestResult(PyPamTestCase):
"{ errors: { {info}{list} } infos: { {info}{list} } }")
class PyPamTestRunTest(unittest.TestCase):
+ def __init__(self, *args, **kwargs):
+ super(PyPamTestRunTest, self).__init__(*args, **kwargs)
+
+ self.PAM_AUTH_ERR = 7
+ if ("BSD" in platform.system()):
+ self.PAM_AUTH_ERR = 9
+
def test_run(self):
neo_password = "secret"
tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE)
@@ -118,12 +125,7 @@ class PyPamTestRunTest(unittest.TestCase):
def test_run_failed_auth(self):
neo_password = "not-the-secret"
- rv = 7 # PAM_AUTH_ERR
-
- # On SRV4 the PAM_AUTH_ERR is 9
- if ("BSD" in platform.system()):
- rv = 9
- tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rv=rv)
+ tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rv=self.PAM_AUTH_ERR)
res = pypamtest.run_pamtest("neo", "matrix_py", [tc], [ neo_password ])
def test_run_chatty_auth(self):