summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2022-05-20 15:10:22 -0400
committerJeff Forcier <jeff@bitprophet.org>2022-05-20 15:10:22 -0400
commitddba5762c9c0878b83fb6a7344ad24ba74af5720 (patch)
tree934dd0038e572bd4a40f75a705f0d0811f76e0c9 /tests
parent1150ed2912343cfcd83684a4515422ea06a759b1 (diff)
parent2ea2ed5430b2f5da7b6116ca336ff3c8bc99cc0e (diff)
Merge branch '2.9' into 2.10
Diffstat (limited to 'tests')
-rw-r--r--tests/blank_rsa.key0
-rw-r--r--tests/test_pkey.py5
2 files changed, 5 insertions, 0 deletions
diff --git a/tests/blank_rsa.key b/tests/blank_rsa.key
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/blank_rsa.key
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index 3bc0459a..f8b7eb42 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -186,6 +186,11 @@ class KeyTest(unittest.TestCase):
with pytest.raises(SSHException, match=str(exception)):
RSAKey.from_private_key_file(_support("test_rsa.key"))
+ def test_loading_empty_keys_errors_usefully(self):
+ # #1599 - raise SSHException instead of IndexError
+ with pytest.raises(SSHException, match="no lines"):
+ RSAKey.from_private_key_file(_support("blank_rsa.key"))
+
def test_load_rsa_password(self):
key = RSAKey.from_private_key_file(
_support("test_rsa_password.key"), "television"