diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-09-20 16:45:11 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-09-20 16:45:11 -0400 |
commit | 8332e974f019e0d0ca18f129b86398e1a826126d (patch) | |
tree | f47d6464323d1a99e5e11630d503b1c41998e0e5 /tests/conftest.py | |
parent | ea0895e2d8a1f2def42ee6696d9a17b4fa20c065 (diff) | |
parent | 2d9bec78f3f8c46f00f585cadae652d6e3aec904 (diff) |
Merge branch 'develop' of ssh://leap.se/keymanager into develop
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), + ] |