libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [1/4] git commit: Add some more test for verify_hostname.
Date Wed, 01 Jan 2014 23:41:41 GMT
Updated Branches:
  refs/heads/trunk 139b2eb5d -> 621ccdd9a


Add some more test for verify_hostname.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/01117eea
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/01117eea
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/01117eea

Branch: refs/heads/trunk
Commit: 01117eead5425c429c2ee3ba0dba1b4080871c67
Parents: 139b2eb
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Wed Jan 1 14:47:56 2014 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu Jan 2 00:09:34 2014 +0100

----------------------------------------------------------------------
 libcloud/test/test_httplib_ssl.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/01117eea/libcloud/test/test_httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_httplib_ssl.py b/libcloud/test/test_httplib_ssl.py
index ddbaa14..5308eee 100644
--- a/libcloud/test/test_httplib_ssl.py
+++ b/libcloud/test/test_httplib_ssl.py
@@ -68,6 +68,7 @@ class TestHttpLibSSLTests(unittest.TestCase):
         self.assertEqual(libcloud.security.CA_CERTS_PATH, [file_path])
 
     def test_verify_hostname(self):
+        # commonName
         cert1 = {'notAfter': 'Feb 16 16:54:50 2013 GMT',
                  'subject': ((('countryName', 'US'),),
                              (('stateOrProvinceName', 'Delaware'),),
@@ -76,6 +77,7 @@ class TestHttpLibSSLTests(unittest.TestCase):
                              (('organizationalUnitName', 'SSL'),),
                              (('commonName', 'somemachine.python.org'),))}
 
+        # commonName
         cert2 = {'notAfter': 'Feb 16 16:54:50 2013 GMT',
                  'subject': ((('countryName', 'US'),),
                              (('stateOrProvinceName', 'Delaware'),),
@@ -86,6 +88,7 @@ class TestHttpLibSSLTests(unittest.TestCase):
                  'subjectAltName': ((('DNS', 'foo.alt.name')),
                                     (('DNS', 'foo.alt.name.1')))}
 
+        # commonName
         cert3 = {'notAfter': 'Feb 16 16:54:50 2013 GMT',
                  'subject': ((('countryName', 'US'),),
                              (('stateOrProvinceName', 'Delaware'),),
@@ -94,6 +97,7 @@ class TestHttpLibSSLTests(unittest.TestCase):
                              (('organizationalUnitName', 'SSL'),),
                              (('commonName', 'python.org'),))}
 
+        # wildcard commonName
         cert4 = {'notAfter': 'Feb 16 16:54:50 2013 GMT',
                  'subject': ((('countryName', 'US'),),
                              (('stateOrProvinceName', 'Delaware'),),
@@ -141,6 +145,12 @@ class TestHttpLibSSLTests(unittest.TestCase):
                         hostname='us-east-1.api.joyentcloud.com', cert=cert4))
         self.assertTrue(self.httplib_object._verify_hostname(
                         hostname='useast-1.api.joyentcloud.com', cert=cert4))
+        self.assertFalse(self.httplib_object._verify_hostname(
+                         hostname='t1.useast-1.api.joyentcloud.com', cert=cert4))
+        self.assertFalse(self.httplib_object._verify_hostname(
+                         hostname='ponies.useast-1.api.joyentcloud.com', cert=cert4))
+        self.assertFalse(self.httplib_object._verify_hostname(
+                         hostname='api.useast-1.api.joyentcloud.com', cert=cert4))
 
     def test_get_subject_alt_names(self):
         cert1 = {'notAfter': 'Feb 16 16:54:50 2013 GMT',


Mime
View raw message