aboutsummaryrefslogtreecommitdiff
path: root/tests/pypamtest_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pypamtest_test.py')
-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):