diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2018-05-30 21:55:40 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-05-30 09:55:40 -0400 |
commit | 830a172072f5fef8d4b1636d251e098bfd269d96 (patch) | |
tree | cb4d7186e405cc8291221f871f7e059bb7eb50cb /tests | |
parent | afdbfb13780fb78e7b277b9de07e7636ba9c5119 (diff) | |
download | cryptography-830a172072f5fef8d4b1636d251e098bfd269d96.tar.gz cryptography-830a172072f5fef8d4b1636d251e098bfd269d96.tar.bz2 cryptography-830a172072f5fef8d4b1636d251e098bfd269d96.zip |
parametrize a few things in test_ec (#4268)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/primitives/test_ec.py | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 59e4c995..5c3da5b6 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -142,43 +142,26 @@ def test_ec_numbers(): assert numbers.public_numbers.y == 3 assert isinstance(numbers.public_numbers.curve, DummyCurve) - with pytest.raises(TypeError): - ec.EllipticCurvePrivateNumbers( - None, - ec.EllipticCurvePublicNumbers( - 2, 3, DummyCurve() - ) - ) - - with pytest.raises(TypeError): - ec.EllipticCurvePrivateNumbers( - 1, - ec.EllipticCurvePublicNumbers( - None, 3, DummyCurve() - ) - ) +@pytest.mark.parametrize( + ("private_value", "x", "y", "curve"), + [ + (None, 2, 3, DummyCurve()), + (1, None, 3, DummyCurve()), + (1, 2, None, DummyCurve()), + (1, 2, 3, None), + ] +) +def test_invalid_ec_numbers_args(private_value, x, y, curve): with pytest.raises(TypeError): ec.EllipticCurvePrivateNumbers( - 1, - ec.EllipticCurvePublicNumbers( - 2, None, DummyCurve() - ) + private_value, ec.EllipticCurvePublicNumbers(x, y, curve) ) - with pytest.raises(TypeError): - ec.EllipticCurvePrivateNumbers( - 1, - ec.EllipticCurvePublicNumbers( - 2, 3, None - ) - ) +def test_invalid_private_numbers_public_numbers(): with pytest.raises(TypeError): - ec.EllipticCurvePrivateNumbers( - 1, - None - ) + ec.EllipticCurvePrivateNumbers(1, None) def test_encode_point(): |