]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Provide clearer assertion messages for test failures
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 5 Oct 2021 06:47:22 +0000 (19:47 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Oct 2021 18:59:31 +0000 (18:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14642

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/raw_testcase.py

index b51ad499192ac9e4e9512fb7b56839e1442e0fa3..188a54451d3e17cbfa6e74f21247afe51e63eaf7 100644 (file)
@@ -1942,7 +1942,12 @@ class RawKerberosTest(TestCaseInTempDir):
             self.assertIsNone(check_error_fn)
             self.assertEqual(0, len(expected_error_mode))
         self.assertIsNotNone(expected_msg_type)
-        self.assertEqual(msg_type, expected_msg_type)
+        if msg_type == KRB_ERROR:
+            error_code = self.getElementValue(rep, 'error-code')
+            fail_msg = f'Got unexpected error: {error_code}'
+        else:
+            fail_msg = f'Expected to fail with error: {expected_error_mode}'
+        self.assertEqual(msg_type, expected_msg_type, fail_msg)
 
         if msg_type == KRB_ERROR:
             return check_error_fn(kdc_exchange_dict,