diff options
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r-- | tests/test_x509_ext.py | 35 |
1 files changed, 24 insertions, 11 deletions
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')>])>" ) |