aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_asym_utils.py5
-rw-r--r--tests/hazmat/primitives/twofactor/test_hotp.py3
-rw-r--r--tests/hazmat/primitives/twofactor/test_totp.py3
-rw-r--r--tests/test_x509_ext.py4
4 files changed, 11 insertions, 4 deletions
diff --git a/tests/hazmat/primitives/test_asym_utils.py b/tests/hazmat/primitives/test_asym_utils.py
index bf55bad8..c3fbedf9 100644
--- a/tests/hazmat/primitives/test_asym_utils.py
+++ b/tests/hazmat/primitives/test_asym_utils.py
@@ -63,3 +63,8 @@ def test_decode_rfc6979_invalid_asn1():
# This byte sequence has an invalid ASN.1 sequence length as well as
# an invalid integer length for the second integer.
decode_rfc6979_signature(b"0\x07\x02\x01\x01\x02\x02\x01")
+
+ with pytest.raises(ValueError):
+ # This is the BER "end-of-contents octets," which pyasn1 is
+ # wrongly willing to return from top-level DER decoding.
+ decode_rfc6979_signature(b"\x00\x00")
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index a76aa6e3..a5d1c284 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -8,10 +8,11 @@ import os
import pytest
-from cryptography.exceptions import InvalidToken, _Reasons
+from cryptography.exceptions import _Reasons
from cryptography.hazmat.backends.interfaces import HMACBackend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.hashes import MD5, SHA1
+from cryptography.hazmat.primitives.twofactor import InvalidToken
from cryptography.hazmat.primitives.twofactor.hotp import HOTP
from ....utils import (
diff --git a/tests/hazmat/primitives/twofactor/test_totp.py b/tests/hazmat/primitives/twofactor/test_totp.py
index 05321089..6039983e 100644
--- a/tests/hazmat/primitives/twofactor/test_totp.py
+++ b/tests/hazmat/primitives/twofactor/test_totp.py
@@ -6,9 +6,10 @@ from __future__ import absolute_import, division, print_function
import pytest
-from cryptography.exceptions import InvalidToken, _Reasons
+from cryptography.exceptions import _Reasons
from cryptography.hazmat.backends.interfaces import HMACBackend
from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives.twofactor import InvalidToken
from cryptography.hazmat.primitives.twofactor.totp import TOTP
from ....utils import (
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index b6bb1881..4811541f 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -150,8 +150,8 @@ class TestKeyUsage(object):
assert repr(ku) == (
"<KeyUsage(digital_signature=True, content_commitment=True, key_en"
"cipherment=False, data_encipherment=False, key_agreement=False, k"
- "ey_cert_sign=True, crl_sign=False, encipher_only=N/A, decipher_on"
- "ly=N/A)>"
+ "ey_cert_sign=True, crl_sign=False, encipher_only=None, decipher_o"
+ "nly=None)>"
)
def test_repr_key_agreement_true(self):