diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-20 18:12:55 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-20 18:12:55 +0200 |
commit | 3f1ca556d14ce71331b8dbc69be4db670863271a (patch) | |
tree | f22b8f35250d8a6431235cb4f3eecb6874208e88 /test/test_certutils.py | |
parent | 91cdd78201497e89b9a17275a484d461f0143137 (diff) | |
download | mitmproxy-3f1ca556d14ce71331b8dbc69be4db670863271a.tar.gz mitmproxy-3f1ca556d14ce71331b8dbc69be4db670863271a.tar.bz2 mitmproxy-3f1ca556d14ce71331b8dbc69be4db670863271a.zip |
python3++
Diffstat (limited to 'test/test_certutils.py')
-rw-r--r-- | test/test_certutils.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/test_certutils.py b/test/test_certutils.py index b44879f6..fc91609e 100644 --- a/test/test_certutils.py +++ b/test/test_certutils.py @@ -36,10 +36,10 @@ class TestCertStore: def test_create_explicit(self): with tutils.tmpdir() as d: ca = certutils.CertStore.from_store(d, "test") - assert ca.get_cert("foo", []) + assert ca.get_cert(b"foo", []) ca2 = certutils.CertStore.from_store(d, "test") - assert ca2.get_cert("foo", []) + assert ca2.get_cert(b"foo", []) assert ca.default_ca.get_serial_number( ) == ca2.default_ca.get_serial_number() @@ -47,11 +47,11 @@ class TestCertStore: def test_create_tmp(self): with tutils.tmpdir() as d: ca = certutils.CertStore.from_store(d, "test") - assert ca.get_cert("foo.com", []) - assert ca.get_cert("foo.com", []) - assert ca.get_cert("*.foo.com", []) + assert ca.get_cert(b"foo.com", []) + assert ca.get_cert(b"foo.com", []) + assert ca.get_cert(b"*.foo.com", []) - r = ca.get_cert("*.foo.com", []) + r = ca.get_cert(b"*.foo.com", []) assert r[1] == ca.default_privatekey def test_add_cert(self): @@ -61,18 +61,18 @@ class TestCertStore: def test_sans(self): with tutils.tmpdir() as d: ca = certutils.CertStore.from_store(d, "test") - c1 = ca.get_cert("foo.com", ["*.bar.com"]) - ca.get_cert("foo.bar.com", []) + c1 = ca.get_cert(b"foo.com", [b"*.bar.com"]) + ca.get_cert(b"foo.bar.com", []) # assert c1 == c2 - c3 = ca.get_cert("bar.com", []) + c3 = ca.get_cert(b"bar.com", []) assert not c1 == c3 def test_sans_change(self): with tutils.tmpdir() as d: ca = certutils.CertStore.from_store(d, "test") - ca.get_cert("foo.com", ["*.bar.com"]) - cert, key, chain_file = ca.get_cert("foo.bar.com", ["*.baz.com"]) - assert "*.baz.com" in cert.altnames + ca.get_cert(b"foo.com", [b"*.bar.com"]) + cert, key, chain_file = ca.get_cert(b"foo.bar.com", [b"*.baz.com"]) + assert b"*.baz.com" in cert.altnames def test_overrides(self): with tutils.tmpdir() as d: @@ -81,14 +81,14 @@ class TestCertStore: assert not ca1.default_ca.get_serial_number( ) == ca2.default_ca.get_serial_number() - dc = ca2.get_cert("foo.com", ["sans.example.com"]) + dc = ca2.get_cert(b"foo.com", [b"sans.example.com"]) dcp = os.path.join(d, "dc") f = open(dcp, "wb") f.write(dc[0].to_pem()) f.close() - ca1.add_cert_file("foo.com", dcp) + ca1.add_cert_file(b"foo.com", dcp) - ret = ca1.get_cert("foo.com", []) + ret = ca1.get_cert(b"foo.com", []) assert ret[0].serial == dc[0].serial |