diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-05-08 16:31:23 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-05-18 13:57:19 -0400 |
commit | ebc96706233346fcfc3071a390037cf26129727b (patch) | |
tree | 54529257b49acfe4d7f92fd1e1b85d4f9378fc7a /tests/test_client.py | |
parent | a644dea52fce383f2fc9df916aa7d6491cd52075 (diff) |
Migrate cert related tests to newer pkey module
- Merge them but also break them up. It's complicated.
- Move cert files into _support
- Related comments in the source as some of this is non-intuitive
Diffstat (limited to 'tests/test_client.py')
-rw-r--r-- | tests/test_client.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/test_client.py b/tests/test_client.py index ea7396d9..5ce6f0a2 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -328,11 +328,10 @@ class SSHClientTest(ClientTest): # server-side behavior is 100% identical.) # NOTE: only bothered whipping up one cert per overall class/family. for type_ in ("rsa", "dss", "ecdsa_256", "ed25519"): - cert_name = "test_{}.key-cert.pub".format(type_) - cert_path = _support(os.path.join("cert_support", cert_name)) + key_path = _support(f"{type_}.key") self._test_connection( - key_filename=cert_path, - public_blob=PublicBlob.from_file(cert_path), + key_filename=key_path, + public_blob=PublicBlob.from_file(f"{key_path}-cert.pub"), ) @requires_sha1_signing @@ -344,13 +343,10 @@ class SSHClientTest(ClientTest): # that a specific cert was found, along with regular authorization # succeeding proving that the overall flow works. for type_ in ("rsa", "dss", "ecdsa_256", "ed25519"): - key_name = "test_{}.key".format(type_) - key_path = _support(os.path.join("cert_support", key_name)) + key_path = _support(f"{type_}.key") self._test_connection( key_filename=key_path, - public_blob=PublicBlob.from_file( - "{}-cert.pub".format(key_path) - ), + public_blob=PublicBlob.from_file(f"{key_path}-cert.pub"), ) def _cert_algo_test(self, ver, alg): @@ -359,9 +355,7 @@ class SSHClientTest(ClientTest): self._test_connection( # NOTE: SSHClient is able to take either the key or the cert & will # set up its internals as needed - key_filename=_support( - os.path.join("cert_support", "test_rsa.key-cert.pub") - ), + key_filename=_support("rsa.key-cert.pub"), server_name="SSH-2.0-OpenSSH_{}".format(ver), ) assert ( |