From 53ce33e4626c33f02a1609aa86f41317099005de Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Sun, 8 Jul 2018 15:42:40 -0700 Subject: [PATCH] Relocate stand-alone fixtures --- tests/fixtures.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/fixtures.py diff --git a/tests/fixtures.py b/tests/fixtures.py new file mode 100644 index 00000000..c8d3b8f4 --- /dev/null +++ b/tests/fixtures.py @@ -0,0 +1,62 @@ +from collections import namedtuple + +import pytest + +from umbral import keys +from umbral.curvebn import CurveBN +from umbral.point import Point + +MockKeyPair = namedtuple('TestKeyPair', 'priv pub') + + +parameters = [ + # (N, M) + (1, 1), + (6, 1), + (6, 4), + (6, 6), + (50, 30) +] + +wrong_parameters = [ + # (N, M) + (-1, -1), (-1, 0), (-1, 5), + (0, -1), (0, 0), (0, 5), + (1, -1), (1, 0), (1, 5), + (5, -1), (5, 0), (5, 10) +] + + +@pytest.fixture(scope='function') +def alices_keys(): + delegating_priv = keys.UmbralPrivateKey.gen_key() + signing_priv = keys.UmbralPrivateKey.gen_key() + return delegating_priv, signing_priv + + +@pytest.fixture(scope='function') +def bobs_keys(): + priv = keys.UmbralPrivateKey.gen_key() + pub = priv.get_pubkey() + return MockKeyPair(priv, pub) + + +@pytest.fixture() +def random_ec_point1(): + yield Point.gen_rand() + + +@pytest.fixture() +def random_ec_point2(): + yield Point.gen_rand() + + +@pytest.fixture() +def random_ec_curvebn1(): + yield CurveBN.gen_rand() + + +@pytest.fixture() +def random_ec_curvebn2(): + yield CurveBN.gen_rand() +