mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Enhance __repr__ method of Principal
`__repr__` now returns more descriptive string containing the actual principal name while keeping the ability to reconstruct the object from it. This makes principal names visible in debug logs, easing troubleshooting a bit. https://fedorahosted.org/freeipa/ticket/6505 Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
0e093f938d
commit
38cc40ddb5
@ -181,3 +181,7 @@ class Principal(object):
|
|||||||
principal_string = u'@'.join([principal_string, realm])
|
principal_string = u'@'.join([principal_string, realm])
|
||||||
|
|
||||||
return principal_string
|
return principal_string
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{0.__module__}.{0.__name__}('{1}')".format(
|
||||||
|
self.__class__, self)
|
||||||
|
@ -82,6 +82,8 @@ def test_principals(valid_principal):
|
|||||||
assert getattr(princ, name) == value
|
assert getattr(princ, name) == value
|
||||||
|
|
||||||
assert unicode(princ) == principal_name
|
assert unicode(princ) == principal_name
|
||||||
|
assert repr(princ) == "ipapython.kerberos.Principal('{}')".format(
|
||||||
|
principal_name)
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_unescaped_ats_raise_error():
|
def test_multiple_unescaped_ats_raise_error():
|
||||||
|
Loading…
Reference in New Issue
Block a user