tests/pam_winbind.py: turn pypamtest.PamTestError into a failure
authorStefan Metzmacher <metze@samba.org>
Wed, 18 Sep 2019 06:04:42 +0000 (08:04 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 24 Sep 2019 18:30:37 +0000 (18:30 +0000)
A failure generated by the AssertionError() checks can be added
to selftest/knownfail.d/*.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
python/samba/tests/pam_winbind.py
python/samba/tests/pam_winbind_chauthtok.py
python/samba/tests/pam_winbind_warn_pwd_expire.py

index 68b05b30d7d3774e3e96eed8f1af6a0a6df4e04e..b05e8af6ffb5ec76bc6d9993d67656edd24a074f 100644 (file)
@@ -30,7 +30,10 @@ class SimplePamTests(samba.tests.TestCase):
         expected_rc = 0  # PAM_SUCCESS
 
         tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc)
-        res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        try:
+            res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        except pypamtest.PamTestError as e:
+            raise AssertionError(str(e))
 
         self.assertTrue(res is not None)
 
@@ -42,7 +45,10 @@ class SimplePamTests(samba.tests.TestCase):
         expected_rc = 7  # PAM_AUTH_ERR
 
         tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc)
-        res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        try:
+            res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        except pypamtest.PamTestError as e:
+            raise AssertionError(str(e))
 
         self.assertTrue(res is not None)
 
@@ -52,6 +58,9 @@ class SimplePamTests(samba.tests.TestCase):
         expected_rc = 0  # PAM_SUCCESS
 
         tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc)
-        res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        try:
+            res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        except pypamtest.PamTestError as e:
+            raise AssertionError(str(e))
 
         self.assertTrue(res is not None)
index e5be3a83ce727e219d471621a11f28487b0de468..18c2705127abb6b193227547797e78a309e6ce37 100644 (file)
@@ -31,6 +31,9 @@ class PamChauthtokTests(samba.tests.TestCase):
         expected_rc = 0 # PAM_SUCCESS
 
         tc = pypamtest.TestCase(pypamtest.PAMTEST_CHAUTHTOK, expected_rc)
-        res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password, newpassword, newpassword])
+        try:
+            res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password, newpassword, newpassword])
+        except pypamtest.PamTestError as e:
+            raise AssertionError(str(e))
 
         self.assertTrue(res is not None)
index df60bc5ace67c8ddd96c0ec2525aa091c9cc179d..1af2f9befe1f8f395857b5297d8e0bda28d93a7d 100644 (file)
@@ -31,7 +31,10 @@ class PasswordExpirePamTests(samba.tests.TestCase):
         expected_rc = 0  # PAM_SUCCESS
 
         tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc)
-        res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        try:
+            res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+        except pypamtest.PamTestError as e:
+            raise AssertionError(str(e))
 
         self.assertTrue(res is not None)
         if warn_pwd_expire == 0: