diff options
author | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-06-16 21:35:24 -0500 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-06-16 22:11:49 -0500 |
commit | a908d691490818aa03fbdb0d3f96448e8edbb8cf (patch) | |
tree | 47b69841764b395dac69ffafffd4f8703a0ea95e /tests/test_x509.py | |
parent | 82fc376961182fb31193373c2d28bc5fe6dd22b4 (diff) | |
download | cryptography-a908d691490818aa03fbdb0d3f96448e8edbb8cf.tar.gz cryptography-a908d691490818aa03fbdb0d3f96448e8edbb8cf.tar.bz2 cryptography-a908d691490818aa03fbdb0d3f96448e8edbb8cf.zip |
Conditionally construct the repr of NameAttributes
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r-- | tests/test_x509.py | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py index 53ddeb84..547aa58e 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -10,6 +10,8 @@ import os import pytest +import six + from cryptography import x509 from cryptography.exceptions import UnsupportedAlgorithm from cryptography.hazmat.backends.interfaces import ( @@ -825,10 +827,16 @@ class TestNameAttribute(object): def test_repr(self): na = x509.NameAttribute(x509.ObjectIdentifier('2.5.4.3'), u'value') - assert repr(na) == ( - "<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName" - ")>, value=u'value')>" - ) + if six.PY3: + assert repr(na) == ( + "<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commo" + "nName)>, value='value')>" + ) + else: + assert repr(na) == ( + "<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commo" + "nName)>, value=u'value')>" + ) class TestObjectIdentifier(object): @@ -879,9 +887,17 @@ class TestName(object): x509.NameAttribute(x509.OID_ORGANIZATION_NAME, u'PyCA'), ]) - assert repr(name) == ( - "<Name([<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=com" - "monName)>, value=u'cryptography.io')>, <NameAttribute(oid=<Object" - "Identifier(oid=2.5.4.10, name=organizationName)>, value=u'PyCA')>" - "])>" - ) + if six.PY3: + assert repr(name) == ( + "<Name([<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name" + "=commonName)>, value='cryptography.io')>, <NameAttribute(oid=" + "<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, valu" + "e='PyCA')>])>" + ) + else: + assert repr(name) == ( + "<Name([<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name" + "=commonName)>, value=u'cryptography.io')>, <NameAttribute(oid" + "=<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, val" + "ue=u'PyCA')>])>" + ) |