Skip to content

Commit

Permalink
Merge pull request #1694 from alex/x509-test-move
Browse files Browse the repository at this point in the history
Updated tests for classes that have been moved
  • Loading branch information
reaperhulk committed Feb 24, 2015
2 parents 3c125b1 + 32c57df commit 4733b47
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/test_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from cryptography.hazmat.backends.interfaces import (
DSABackend, EllipticCurveBackend, RSABackend, X509Backend
)
from cryptography.hazmat.primitives import hashes, interfaces
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa

from .hazmat.primitives.test_ec import _skip_curve_unsupported
from .utils import load_vectors_from_file
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_load_good_ca_cert(self, backend):
assert cert.not_valid_after == datetime.datetime(2030, 12, 31, 8, 30)
assert cert.serial == 2
public_key = cert.public_key()
assert isinstance(public_key, interfaces.RSAPublicKey)
assert isinstance(public_key, rsa.RSAPublicKey)
assert cert.version is x509.Version.v3
fingerprint = binascii.hexlify(cert.fingerprint(hashes.SHA1()))
assert fingerprint == b"6f49779533d565e8b7c1062503eab41492c38e4d"
Expand Down Expand Up @@ -352,8 +352,8 @@ def test_load_dsa_cert(self, backend):
)
assert isinstance(cert.signature_hash_algorithm, hashes.SHA1)
public_key = cert.public_key()
assert isinstance(public_key, interfaces.DSAPublicKey)
if isinstance(public_key, interfaces.DSAPublicKeyWithNumbers):
assert isinstance(public_key, dsa.DSAPublicKey)
if isinstance(public_key, dsa.DSAPublicKeyWithNumbers):
num = public_key.public_numbers()
assert num.y == int(
"4c08bfe5f2d76649c80acf7d431f6ae2124b217abc8c9f6aca776ddfa94"
Expand Down Expand Up @@ -405,10 +405,8 @@ def test_load_ecdsa_cert(self, backend):
)
assert isinstance(cert.signature_hash_algorithm, hashes.SHA384)
public_key = cert.public_key()
assert isinstance(public_key, interfaces.EllipticCurvePublicKey)
if isinstance(
public_key, interfaces.EllipticCurvePublicKeyWithNumbers
):
assert isinstance(public_key, ec.EllipticCurvePublicKey)
if isinstance(public_key, ec.EllipticCurvePublicKeyWithNumbers):
num = public_key.public_numbers()
assert num.x == int(
"dda7d9bb8ab80bfb0b7f21d2f0bebe73f3335d1abc34eadec69bbcd095f"
Expand Down

0 comments on commit 4733b47

Please sign in to comment.