From ffca0103fceb9d283eb36f175cb76597183de255 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 24 Mar 2020 08:37:24 +0100 Subject: tests: Define PAM_AUTH_ERROR in init function Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- tests/pypamtest_test.py | 14 ++++++++------ 1 file 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): -- cgit v1.2.3