mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does. I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver. Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
20 lines
725 B
Python
20 lines
725 B
Python
import collections
|
|
import tempfile
|
|
|
|
from Crypto.PublicKey import RSA
|
|
|
|
|
|
def generate_ssh_keys():
|
|
"""Returns a named tuple with private and public key and their paths."""
|
|
key = RSA.generate(2048)
|
|
private_key = key.export_key()
|
|
public_key = key.publickey().export_key(format='OpenSSH')
|
|
ssh_keys = collections.namedtuple('SSHKeys', 'private_key public_key private_key_file public_key_file')
|
|
with tempfile.NamedTemporaryFile(delete=False) as f:
|
|
f.write(private_key)
|
|
private_key_file = f.name
|
|
with tempfile.NamedTemporaryFile(delete=False) as f:
|
|
f.write(public_key)
|
|
public_key_file = f.name
|
|
return ssh_keys(private_key, public_key, private_key_file, public_key_file)
|