diff options
author | drebs <drebs@leap.se> | 2016-08-12 08:34:31 -0300 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2016-09-01 17:39:10 +0200 |
commit | 2d9bec78f3f8c46f00f585cadae652d6e3aec904 (patch) | |
tree | e22eecbf2fb34d134c4e975465c122ce49d12a62 /tests/conftest.py | |
parent | 354ad5a12e90463f9952fe056f191c6d4cdadf40 (diff) |
[test] add speed tests for gpg/wrapper init/enc/dec
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..0c428a0 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,51 @@ +import pytest + +from leap.keymanager.keys import build_key_from_dict +from common import ADDRESS +from common import KEY_FINGERPRINT +from common import PUBLIC_KEY +from common import PRIVATE_KEY +from common import ADDRESS_2 +from common import KEY_FINGERPRINT_2 +from common import PUBLIC_KEY_2 +from common import PRIVATE_KEY_2 +from leap.keymanager.wrapper import TempGPGWrapper + + +@pytest.fixture +def wrapper(keys=None): + return TempGPGWrapper(keys=keys) + + +def _get_key(address, key_fingerprint, key_data, private): + kdict = { + 'uids': [address], + 'fingerprint': key_fingerprint, + 'key_data': key_data, + 'private': private, + 'length': 4096, + 'expiry_date': 0, + 'refreshed_at': 1311239602, + } + key = build_key_from_dict(kdict) + return key + + +@pytest.fixture +def public_key(): + return _get_key(ADDRESS, KEY_FINGERPRINT, PUBLIC_KEY, False) + + +@pytest.fixture +def public_key_2(): + return _get_key(ADDRESS_2, KEY_FINGERPRINT_2, PUBLIC_KEY_2, False) + + +@pytest.fixture +def openpgp_keys(): + return [ + _get_key(ADDRESS, KEY_FINGERPRINT, PUBLIC_KEY, False), + _get_key(ADDRESS_2, KEY_FINGERPRINT_2, PUBLIC_KEY_2, False), + _get_key(ADDRESS, KEY_FINGERPRINT, PRIVATE_KEY, True), + _get_key(ADDRESS_2, KEY_FINGERPRINT_2, PRIVATE_KEY_2, True), + ] |