mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
add Cert.__repr__
to ease debugging
This commit is contained in:
parent
c718d4f7b0
commit
34774885e0
@ -49,6 +49,9 @@ class Cert(serializable.Serializable):
|
|||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.fingerprint() == other.fingerprint()
|
return self.fingerprint() == other.fingerprint()
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<Cert(cn={self.cn!r}, altnames={self.altnames!r})>"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_state(cls, state):
|
def from_state(cls, state):
|
||||||
return cls.from_pem(state)
|
return cls.from_pem(state)
|
||||||
|
@ -180,6 +180,7 @@ class TestCert:
|
|||||||
assert c2.issuer
|
assert c2.issuer
|
||||||
assert c2.to_pem()
|
assert c2.to_pem()
|
||||||
assert c2.has_expired() is not None
|
assert c2.has_expired() is not None
|
||||||
|
assert repr(c2) == "<Cert(cn='www.inode.co.nz', altnames=['www.inode.co.nz', 'inode.co.nz'])>"
|
||||||
|
|
||||||
assert c1 != c2
|
assert c1 != c2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user