summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-08-21 19:02:12 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-08-21 19:03:09 -0700
commit42203eb433c454f948079a5009da89d8ece84694 (patch)
tree0d5685c8ea602676f88919f3dfe2a7cc087a37db
parent56af5a781a90606228134e57128513f3afcfb6d7 (diff)
downloadparamiko-42203eb433c454f948079a5009da89d8ece84694.tar.gz
Start in on stub tests, then realize I'm too used to my custom test runner
-rw-r--r--tests/test_certs.py28
-rw-r--r--tests/test_rsa-cert.pub1
2 files changed, 18 insertions, 11 deletions
diff --git a/tests/test_certs.py b/tests/test_certs.py
index a80a917c..97678d29 100644
--- a/tests/test_certs.py
+++ b/tests/test_certs.py
@@ -7,7 +7,7 @@ from itertools import product
from paramiko.py3compat import StringIO
from cryptography.hazmat.primitives.asymmetric import rsa
-from paramiko import Message, RSAKey
+from paramiko import Message, RSAKey, SSHException
from paramiko.py3compat import byte_chr
from paramiko.rsacert import RSACert
@@ -68,15 +68,21 @@ class RSACertTests(unittest.TestCase):
# loaded that name + -pub.cert
pass
- def excepts_if_no_cert_data_available(self):
- # TODO: no cert_filename _or_ cert_file_obj _or_ data kwargs
- pass
-
- def excepts_if_private_key_is_not_given(self):
+ def test_excepts_if_no_cert_data_available(self):
+ try:
+ RSACert()
+ # TODO: custom exc subclass
+ except SSHException as e:
+ err = "Must provide data, msg, cert_filename or cert_file_obj!"
+ self.assertEqual(str(e), err)
+ else:
+ assert False, "Did not raise SSHException!"
+
+ def test_excepts_if_private_key_is_not_given(self):
# TODO: no pkey_filename, pkey_file_obj, or key
pass
- def excepts_if_only_public_key_is_given(self):
+ def test_excepts_if_only_public_key_is_given(self):
# TODO: not 100% sure this should actually except tho
# TODO: but, pkey_filename/pkey_file_obj/key are public-key material
# only, no private. In that case, why did the user bother? That should
@@ -85,16 +91,16 @@ class RSACertTests(unittest.TestCase):
# but they only contain a public key
pass
- def excepts_if_public_numbers_mismatch(self):
+ def test_excepts_if_public_numbers_mismatch(self):
# TODO: given key isn't actually the match of the certified one!
pass
- def excepts_if_key_data_given_more_than_one_way(self):
+ def test_excepts_if_key_data_given_more_than_one_way(self):
# TODO: more than one of key, pkey_filename or pkey_file_obj; all
# combos of these.
pass
- def excepts_if_cert_data_given_more_than_one_way(self):
+ def test_excepts_if_cert_data_given_more_than_one_way(self):
# TODO: cert data given via more than one of cert_filename,
# cert_file_obj, msg, or data. All combos.
pass
@@ -131,7 +137,7 @@ class RSACertTests(unittest.TestCase):
cert_without_private_key.get_public_key(),
)
- def vestigial_methods_raise_NotImplementedError(self):
+ def test_vestigial_methods_raise_NotImplementedError(self):
# TODO: generate
# TODO: from_private_key_file
# TODO: from_private_key
diff --git a/tests/test_rsa-cert.pub b/tests/test_rsa-cert.pub
new file mode 100644
index 00000000..22eceed7
--- /dev/null
+++ b/tests/test_rsa-cert.pub
@@ -0,0 +1 @@
+ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgSMQNY/NloAtYIUsc0Hn+iESDMQSes4l6bLaQfZh5NxwAAAABIwAAAIEA049W6geFpmsljTwfvI1UmKWWJPNFI74+vNKTk4dmzkQY2yAMs6FhlvhlI8ysU4oj71ZsRYMecHbBbxdN79+JRFVYTKaLqjwGENeTd+yv4q+V2PvZv3fLnzApI3l7EJCqhWwJUHJ1jAkZzqDx0tyOL4uoZpww3nmE0kb3y21tH4cAAAAAAAAAAAAAAAEAAAANdXNlcl91c2VybmFtZQAAAAwAAAAIdXNlcm5hbWUAAAAAVWQGuAAAAABXQ+kGAAAAAAAAAIIAAAAVcGVybWl0LVgxMS1mb3J3YXJkaW5nAAAAAAAAABdwZXJtaXQtYWdlbnQtZm9yd2FyZGluZwAAAAAAAAAWcGVybWl0LXBvcnQtZm9yd2FyZGluZwAAAAAAAAAKcGVybWl0LXB0eQAAAAAAAAAOcGVybWl0LXVzZXItcmMAAAAAAAAAAAAAARcAA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