aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2016-03-06 19:10:56 -0430
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-03-06 19:12:43 -0430
commit641149c2b4cc17edd5934d76e23a47d782b28f55 (patch)
tree29adf4b3413796d53cd89832d11bad6cf41b46f8 /tests/test_x509.py
parent6960600f111de1710b01cc4f4ffc6c023d742cd7 (diff)
downloadcryptography-641149c2b4cc17edd5934d76e23a47d782b28f55.tar.gz
cryptography-641149c2b4cc17edd5934d76e23a47d782b28f55.tar.bz2
cryptography-641149c2b4cc17edd5934d76e23a47d782b28f55.zip
raise ValueError if > 2 byte value for NameAttribute with CN OID
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r--tests/test_x509.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 6145edb1..9054c4ed 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -3327,6 +3327,20 @@ class TestNameAttribute(object):
b'bytes'
)
+ def test_init_bad_country_code_value(self):
+ with pytest.raises(ValueError):
+ x509.NameAttribute(
+ NameOID.COUNTRY_NAME,
+ u'United States'
+ )
+
+ # unicode string of length 2, but > 2 bytes
+ with pytest.raises(ValueError):
+ x509.NameAttribute(
+ NameOID.COUNTRY_NAME,
+ u'\U0001F37A\U0001F37A'
+ )
+
def test_eq(self):
assert x509.NameAttribute(
x509.ObjectIdentifier('2.999.1'), u'value'