summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/krb5/raw_testcase.py5
-rw-r--r--python/samba/tests/krb5/rfc4120_constants.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/python/samba/tests/krb5/raw_testcase.py b/python/samba/tests/krb5/raw_testcase.py
index 07bf4490104..e36e8fce418 100644
--- a/python/samba/tests/krb5/raw_testcase.py
+++ b/python/samba/tests/krb5/raw_testcase.py
@@ -130,6 +130,7 @@ from samba.tests.krb5.rfc4120_constants import (
PADATA_REQ_ENC_PA_REP,
PADATA_SUPPORTED_ETYPES,
TD_CMS_DIGEST_ALGORITHMS,
+ errmap
)
import samba.tests.krb5.kcrypto as kcrypto
@@ -5080,7 +5081,9 @@ class RawKerberosTest(TestCase):
self.assertElementEqual(rep, 'pvno', 5)
self.assertElementEqual(rep, 'msg-type', KRB_ERROR)
error_code = self.getElementValue(rep, 'error-code')
- self.assertIn(error_code, expected_error_mode)
+ self.assertIn(error_code, expected_error_mode,
+ f"{errmap.get(error_code)} not in "
+ f"{[errmap.get(e) for e in expected_error_mode]}")
if self.strict_checking:
self.assertElementMissing(rep, 'ctime')
self.assertElementMissing(rep, 'cusec')
diff --git a/python/samba/tests/krb5/rfc4120_constants.py b/python/samba/tests/krb5/rfc4120_constants.py
index c98f1c67b12..a643f40c4af 100644
--- a/python/samba/tests/krb5/rfc4120_constants.py
+++ b/python/samba/tests/krb5/rfc4120_constants.py
@@ -132,6 +132,8 @@ KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED = 81
KDC_ERR_PREAUTH_EXPIRED = 90
KDC_ERR_UNKNOWN_CRITICAL_FAST_OPTIONS = 93
+errmap = {v: k for k, v in globals().items() if k[:8] == 'KDC_ERR_'}
+
# Kpasswd error codes
KPASSWD_SUCCESS = 0
KPASSWD_MALFORMED = 1