diff options
| author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2025-11-05 12:50:31 +1300 |
|---|---|---|
| committer | Jennifer Sutton <jsutton@samba.org> | 2025-11-20 21:25:39 +0000 |
| commit | e90184fbdaa2ac1c438548e98dd4953779cb3a60 (patch) | |
| tree | c6f94bb999272dd8f6e564700086124ae838499f /python | |
| parent | 8a9a4f2ff2d9f5944d1f41c3d3b0c0f362dfb863 (diff) | |
| download | samba-e90184fbdaa2ac1c438548e98dd4953779cb3a60.tar.gz samba-e90184fbdaa2ac1c438548e98dd4953779cb3a60.tar.bz2 samba-e90184fbdaa2ac1c438548e98dd4953779cb3a60.zip | |
pytest:krb5: errcode errors include names
Before:
> AssertionError: 6 not found in (20,)
After:
> AssertionError: 6 not found in (20,) : KDC_ERR_C_PRINCIPAL_UNKNOWN not in ['KDC_ERR_TGT_REVOKED']
Useful for people who don't know the codes off by heart.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/tests/krb5/raw_testcase.py | 5 | ||||
| -rw-r--r-- | python/samba/tests/krb5/rfc4120_constants.py | 2 |
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 |
