aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/backends/test_openssl.py5
-rw-r--r--tests/hazmat/primitives/test_ec.py29
2 files changed, 17 insertions, 17 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 0dd91695..bd99c8f2 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -487,11 +487,6 @@ class TestOpenSSLNoEllipticCurve(object):
None, None
) is False
- def test_supported_curves(self, monkeypatch):
- monkeypatch.setattr(backend._lib, "Cryptography_HAS_EC", 0)
-
- assert backend._supported_curves() == []
-
class TestDeprecatedRSABackendMethods(object):
def test_create_rsa_signature_ctx(self):
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py
index 1879f4fc..2690e794 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -70,6 +70,15 @@ def _skip_ecdsa_vector(backend, curve_type, hash_type):
)
+def _skip_curve_unsupported(backend, curve):
+ if not backend.elliptic_curve_supported(curve):
+ pytest.skip(
+ "Curve {0} is not supported by this backend {1}".format(
+ curve.name, backend
+ )
+ )
+
+
@utils.register_interface(interfaces.EllipticCurve)
class DummyCurve(object):
name = "dummy-curve"
@@ -81,6 +90,12 @@ class DummySignatureAlgorithm(object):
pass
+@pytest.mark.elliptic
+def test_skip_curve_unsupported(backend):
+ with pytest.raises(pytest.skip.Exception):
+ _skip_curve_unsupported(backend, DummyCurve())
+
+
def test_ec_numbers():
numbers = ec.EllipticCurvePrivateNumbers(
1,
@@ -176,12 +191,7 @@ class TestECDSAVectors(object):
"curve", _CURVE_TYPES.values()
)
def test_generate_vector_curves(self, backend, curve):
- if not backend.elliptic_curve_supported(curve()):
- pytest.skip(
- "Curve {0} is not supported by this backend {1}".format(
- curve().name, backend
- )
- )
+ _skip_curve_unsupported(backend, curve())
key = ec.generate_private_key(curve(), backend)
assert key
@@ -205,12 +215,7 @@ class TestECDSAVectors(object):
) is False
def test_unknown_signature_algoritm(self, backend):
- if not backend.elliptic_curve_supported(ec.SECP192R1()):
- pytest.skip(
- "Curve secp192r1 is not supported by this backend {0}".format(
- backend
- )
- )
+ _skip_curve_unsupported(backend, ec.SECP192R1())
key = ec.generate_private_key(ec.SECP192R1(), backend)