aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_certutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_certutils.py')
-rw-r--r--test/test_certutils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_certutils.py b/test/test_certutils.py
index 334a6be4..89b6ff50 100644
--- a/test/test_certutils.py
+++ b/test/test_certutils.py
@@ -53,22 +53,22 @@ class TestDummyCert:
assert certutils.dummy_ca(cacert)
p = os.path.join(d, "foo")
certutils.dummy_cert(
- file(p, "w"),
+ file(p, "wb"),
cacert,
"foo.com",
["one.com", "two.com", "*.three.com"]
)
- assert file(p).read()
+ assert file(p,"rb").read()
class TestSSLCert:
def test_simple(self):
- c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert"), "r").read())
+ c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert"), "rb").read())
assert c.cn == "google.com"
assert len(c.altnames) == 436
- c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert_2"), "r").read())
+ c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert_2"), "rb").read())
assert c.cn == "www.inode.co.nz"
assert len(c.altnames) == 2
assert c.digest("sha1")
@@ -82,11 +82,11 @@ class TestSSLCert:
c.has_expired
def test_err_broken_sans(self):
- c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert_weird1"), "r").read())
+ c = certutils.SSLCert.from_pem(file(tutils.test_data.path("data/text_cert_weird1"), "rb").read())
# This breaks unless we ignore a decoding error.
c.altnames
def test_der(self):
- d = file(tutils.test_data.path("data/dercert")).read()
+ d = file(tutils.test_data.path("data/dercert"),"rb").read()
s = certutils.SSLCert.from_der(d)
assert s.cn