From 2dd845ed95db54be2a9548e54f3fcdc6c82d472a Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 22 Nov 2021 12:55:17 +0100 Subject: [PATCH] catch malformed cert warning in tests we may need to catch this properly in `get_cert` at some point, let's see if this ever turns out to be an issue. --- test/mitmproxy/addons/test_tlsconfig.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/mitmproxy/addons/test_tlsconfig.py b/test/mitmproxy/addons/test_tlsconfig.py index 115d92c0c..2f203713d 100644 --- a/test/mitmproxy/addons/test_tlsconfig.py +++ b/test/mitmproxy/addons/test_tlsconfig.py @@ -86,7 +86,8 @@ class TestTlsConfig: with open(tdata.path("mitmproxy/data/invalid-subject.pem"), "rb") as f: ctx.server.certificate_list = [certs.Cert.from_pem(f.read())] - assert ta.get_cert(ctx) # does not raise + with pytest.warns(UserWarning, match="Country names should be two characters"): + assert ta.get_cert(ctx) # does not raise def test_tls_clienthello(self): # only really testing for coverage here, there's no point in mirroring the individual conditions