From 34774885e070a581fcf59e64fe0d22e5b42a6cca Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 19 Jul 2021 15:18:13 +0200 Subject: [PATCH] add `Cert.__repr__` to ease debugging --- mitmproxy/certs.py | 3 +++ test/mitmproxy/test_certs.py | 1 + 2 files changed, 4 insertions(+) diff --git a/mitmproxy/certs.py b/mitmproxy/certs.py index be801b92e..7977d464a 100644 --- a/mitmproxy/certs.py +++ b/mitmproxy/certs.py @@ -49,6 +49,9 @@ class Cert(serializable.Serializable): def __eq__(self, other): return self.fingerprint() == other.fingerprint() + def __repr__(self): + return f"" + @classmethod def from_state(cls, state): return cls.from_pem(state) diff --git a/test/mitmproxy/test_certs.py b/test/mitmproxy/test_certs.py index e3036e839..53658f2ae 100644 --- a/test/mitmproxy/test_certs.py +++ b/test/mitmproxy/test_certs.py @@ -180,6 +180,7 @@ class TestCert: assert c2.issuer assert c2.to_pem() assert c2.has_expired() is not None + assert repr(c2) == "" assert c1 != c2