diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-04-26 16:07:59 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-05-05 12:27:20 -0400 |
commit | 9ece9fcc8d8e5d22de0a65fcc44374a53c31dfdb (patch) | |
tree | d026bf1fec63d22662814e3c6259530500c31b3a | |
parent | 7700c7e033652ed98c0c385b0da936f12b35aabf (diff) |
Start moving key fixtures into support folder
-rw-r--r-- | tests/_support/dss.key (renamed from tests/test_dss.key) | 0 | ||||
-rw-r--r-- | tests/test_auth.py | 4 | ||||
-rw-r--r-- | tests/test_client.py | 2 | ||||
-rw-r--r-- | tests/test_pkey.py | 8 | ||||
-rw-r--r-- | tests/test_transport.py | 2 | ||||
-rw-r--r-- | tests/util.py | 6 |
6 files changed, 13 insertions, 9 deletions
diff --git a/tests/test_dss.key b/tests/_support/dss.key index e10807f1..e10807f1 100644 --- a/tests/test_dss.key +++ b/tests/_support/dss.key diff --git a/tests/test_auth.py b/tests/test_auth.py index 4a960deb..592e589f 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -47,7 +47,7 @@ _pwd = u("\u2022") class NullServer(ServerInterface): paranoid_did_password = False paranoid_did_public_key = False - paranoid_key = DSSKey.from_private_key_file(_support("test_dss.key")) + paranoid_key = DSSKey.from_private_key_file(_support("dss.key")) def get_allowed_auths(self, username): if username == "slowdive": @@ -186,7 +186,7 @@ class AuthTest(unittest.TestCase): username="paranoid", password="paranoid" ) self.assertEqual(["publickey"], remain) - key = DSSKey.from_private_key_file(_support("test_dss.key")) + key = DSSKey.from_private_key_file(_support("dss.key")) remain = self.tc.auth_publickey(username="paranoid", key=key) self.assertEqual([], remain) self.verify_finished() diff --git a/tests/test_client.py b/tests/test_client.py index 21ecd72a..62c92b35 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -256,7 +256,7 @@ class SSHClientTest(ClientTest): """ verify that SSHClient works with a DSA key. """ - self._test_connection(key_filename=_support("test_dss.key")) + self._test_connection(key_filename=_support("dss.key")) @requires_sha1_signing def test_client_rsa(self): diff --git a/tests/test_pkey.py b/tests/test_pkey.py index b1b9d51c..5dfaaff7 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -203,7 +203,7 @@ class KeyTest(unittest.TestCase): self.assertEqual(1024, key.get_bits()) def test_load_dss(self): - key = DSSKey.from_private_key_file(_support("test_dss.key")) + key = DSSKey.from_private_key_file(_support("dss.key")) self.assertEqual("ssh-dss", key.get_name()) exp_dss = b(FINGER_DSS.split()[1].replace(":", "")) my_dss = hexlify(key.get_fingerprint()) @@ -240,7 +240,7 @@ class KeyTest(unittest.TestCase): def test_compare_dss(self): # verify that the private & public keys compare equal - key = DSSKey.from_private_key_file(_support("test_dss.key")) + key = DSSKey.from_private_key_file(_support("dss.key")) self.assertEqual(key, key) pub = DSSKey(data=key.asbytes()) self.assertTrue(key.can_sign()) @@ -273,7 +273,7 @@ class KeyTest(unittest.TestCase): def test_sign_dss(self): # verify that the dss private key can sign and verify - key = DSSKey.from_private_key_file(_support("test_dss.key")) + key = DSSKey.from_private_key_file(_support("dss.key")) msg = key.sign_ssh_data(b"ice weasels") self.assertTrue(type(msg) is Message) msg.rewind() @@ -619,7 +619,7 @@ class KeyTest(unittest.TestCase): def keys(self): for key_class, filename in [ (RSAKey, "test_rsa.key"), - (DSSKey, "test_dss.key"), + (DSSKey, "dss.key"), (ECDSAKey, "test_ecdsa_256.key"), (Ed25519Key, "test_ed25519.key"), ]: diff --git a/tests/test_transport.py b/tests/test_transport.py index 6feccf1d..a6b15ee1 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -80,7 +80,7 @@ Maybe. class NullServer(ServerInterface): paranoid_did_password = False paranoid_did_public_key = False - paranoid_key = DSSKey.from_private_key_file(_support("test_dss.key")) + paranoid_key = DSSKey.from_private_key_file(_support("dss.key")) def __init__(self, allowed_keys=None): self.allowed_keys = allowed_keys if allowed_keys is not None else [] diff --git a/tests/util.py b/tests/util.py index 0639f8ae..2f1c5ac2 100644 --- a/tests/util.py +++ b/tests/util.py @@ -1,6 +1,7 @@ from os.path import dirname, realpath, join import builtins import os +from pathlib import Path import struct import sys import unittest @@ -18,7 +19,10 @@ tests_dir = dirname(realpath(__file__)) def _support(filename): - return join(tests_dir, filename) + base = Path(tests_dir) + top = base / filename + deeper = base / "_support" / filename + return str(deeper if deeper.exists() else top) def _config(name): |