aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-11 21:22:38 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-11 21:22:38 -0500
commit73be2ca86049fd15f1ab37d7201a9b32264402ab (patch)
treee94e1b904c9085d242e4b73ba1562b672e2a0ca3
parent9aaef9e516ae1c54c79f07b0441c21c29f8aeb15 (diff)
downloadcryptography-73be2ca86049fd15f1ab37d7201a9b32264402ab.tar.gz
cryptography-73be2ca86049fd15f1ab37d7201a9b32264402ab.tar.bz2
cryptography-73be2ca86049fd15f1ab37d7201a9b32264402ab.zip
alter the repr a bit, pass unicode everywhere
-rw-r--r--src/cryptography/x509.py2
-rw-r--r--tests/test_x509_ext.py35
2 files changed, 25 insertions, 12 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 02277658..50fae716 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -546,7 +546,7 @@ class NoticeReference(object):
def __repr__(self):
return (
- "<NoticeReference(organization={0.organization}, notice_numbers="
+ "<NoticeReference(organization={0.organization!r}, notice_numbers="
"{0.notice_numbers})>".format(self)
)
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index fa025d9c..ae69f5fc 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -50,11 +50,18 @@ class TestNoticeReference(object):
assert nr.notice_numbers is None
def test_repr(self):
- nr = x509.NoticeReference("org", [1, 3, 4])
+ nr = x509.NoticeReference(u"org", [1, 3, 4])
- assert repr(nr) == (
- "<NoticeReference(organization=org, notice_numbers=[1, 3, 4])>"
- )
+ if six.PY3:
+ assert repr(nr) == (
+ "<NoticeReference(organization='org', notice_numbers=[1, 3, 4"
+ "])>"
+ )
+ else:
+ assert repr(nr) == (
+ "<NoticeReference(organization=u'org', notice_numbers=[1, 3, "
+ "4])>"
+ )
class TestUserNotice(object):
@@ -68,11 +75,17 @@ class TestUserNotice(object):
assert un.explicit_text == "text"
def test_repr(self):
- un = x509.UserNotice(x509.NoticeReference("org", None), "text")
- assert repr(un) == (
- "<UserNotice(notice_reference=<NoticeReference(organization=org, "
- "notice_numbers=None)>, explicit_text='text')>"
- )
+ un = x509.UserNotice(x509.NoticeReference(u"org", None), u"text")
+ if six.PY3:
+ assert repr(un) == (
+ "<UserNotice(notice_reference=<NoticeReference(organization='"
+ "org', notice_numbers=None)>, explicit_text='text')>"
+ )
+ else:
+ assert repr(un) == (
+ "<UserNotice(notice_reference=<NoticeReference(organization=u"
+ "'org', notice_numbers=None)>, explicit_text=u'text')>"
+ )
class TestPolicyInformation(object):
@@ -96,7 +109,7 @@ class TestPolicyInformation(object):
x509.PolicyInformation(x509.ObjectIdentifier("1.2.3"), [1, 2])
def test_repr(self):
- pq = [u"string", x509.UserNotice(None, "hi")]
+ pq = [u"string", x509.UserNotice(None, u"hi")]
pi = x509.PolicyInformation(x509.ObjectIdentifier("1.2.3"), pq)
if six.PY3:
assert repr(pi) == (
@@ -108,7 +121,7 @@ class TestPolicyInformation(object):
assert repr(pi) == (
"<PolicyInformation(policy_identifier=<ObjectIdentifier(oid=1."
"2.3, name=Unknown OID)>, policy_qualifiers=[u'string', <UserN"
- "otice(notice_reference=None, explicit_text='hi')>])>"
+ "otice(notice_reference=None, explicit_text=u'hi')>])>"
)