diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-27 09:35:17 +0900 | 
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-27 09:35:17 +0900 | 
| commit | 8b5d094ca3bb5cafa61001b83c1798e40af37223 (patch) | |
| tree | 0c9c64aecf999e8d4d92ac2b72dd7f22fdcd3265 | |
| parent | 5a2bb54bbb7b68a7407ab5d62c828c329166bd81 (diff) | |
| download | cryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.tar.gz cryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.tar.bz2 cryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.zip | |
switch to using pyasn1_modules for the test
| -rw-r--r-- | dev-requirements.txt | 2 | ||||
| -rw-r--r-- | setup.py | 2 | ||||
| -rw-r--r-- | tests/test_x509.py | 26 | ||||
| -rw-r--r-- | tox.ini | 2 | 
4 files changed, 17 insertions, 15 deletions
| diff --git a/dev-requirements.txt b/dev-requirements.txt index 2c0ca18c..f6eec132 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,3 @@ -asn1crypto  coverage  flake8  flake8-import-order @@ -6,6 +5,7 @@ invoke  iso8601  pep8-naming  pretend +pyasn1_modules  pytest  requests  sphinx @@ -63,7 +63,7 @@ test_requirements = [      "pretend",      "iso8601",      "hypothesis", -    "asn1crypto", +    "pyasn1_modules",  ]  # If there's no vectors locally that probably means we are in a tarball and diff --git a/tests/test_x509.py b/tests/test_x509.py index 1fa4d82a..79424752 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -9,7 +9,9 @@ import datetime  import ipaddress  import os -from asn1crypto import core, x509 as asn1cryptox509 +from pyasn1.codec.der import decoder + +from pyasn1_modules import rfc2459  import pytest @@ -861,17 +863,17 @@ class TestRSACertificateRequest(object):          cert = builder.sign(issuer_private_key, hashes.SHA256(), backend) -        parsedasn1 = asn1cryptox509.Certificate.load( -            cert.public_bytes(serialization.Encoding.DER) -        ) -        assert isinstance( -            parsedasn1.subject.chosen[0][0]['value'].chosen, -            core.PrintableString -        ) -        assert isinstance( -            parsedasn1.subject.chosen[1][0]['value'].chosen, -            core.UTF8String -        ) +        parsed, _ = decoder.decode( +            cert.public_bytes(serialization.Encoding.DER), +            asn1Spec=rfc2459.Certificate() +        ) +        tbs_cert = parsed.getComponentByName('tbsCertificate') +        subject = tbs_cert.getComponentByName('subject') +        issuer = tbs_cert.getComponentByName('issuer') +        # \x13 is printable string. The first byte of the value of the +        # node corresponds to the ASN.1 string type. +        assert str(subject[0][0][0][1])[0] == "\x13" +        assert str(issuer[0][0][0][1])[0] == "\x13"  class TestCertificateBuilder(object): @@ -9,7 +9,7 @@ deps =      pretend      pytest      hypothesis>=1.11.4 -    asn1crypto +    pyasn1_modules      ./vectors  passenv = ARCHFLAGS LDFLAGS CFLAGS INCLUDE LIB LD_LIBRARY_PATH USERNAME  commands = | 
