summaryrefslogtreecommitdiff
path: root/tests/integration_tests/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration_tests/util.py')
-rw-r--r--tests/integration_tests/util.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/integration_tests/util.py b/tests/integration_tests/util.py
index 3ef12358..ce62ffc8 100644
--- a/tests/integration_tests/util.py
+++ b/tests/integration_tests/util.py
@@ -3,8 +3,15 @@ import multiprocessing
import os
import time
from contextlib import contextmanager
+from collections import namedtuple
+from pathlib import Path
+
log = logging.getLogger('integration_testing')
+key_pair = namedtuple('key_pair', 'public_key private_key')
+
+ASSETS_DIR = Path('tests/integration_tests/assets')
+KEY_PATH = ASSETS_DIR / 'keys'
def verify_ordered_items_in_text(to_verify: list, text: str):
@@ -47,3 +54,13 @@ def emit_dots_on_travis():
yield
finally:
dot_process.terminate()
+
+
+def get_test_rsa_keypair(key_name: str = 'test1') -> key_pair:
+ private_key_path = KEY_PATH / 'id_rsa.{}'.format(key_name)
+ public_key_path = KEY_PATH / 'id_rsa.{}.pub'.format(key_name)
+ with public_key_path.open() as public_file:
+ public_key = public_file.read()
+ with private_key_path.open() as private_file:
+ private_key = private_file.read()
+ return key_pair(public_key, private_key)