]> granicus.if.org Git - python/commitdiff
Added tests for other methods of SSL object. Now we cover
authorFacundo Batista <facundobatista@gmail.com>
Sun, 22 Apr 2007 01:18:56 +0000 (01:18 +0000)
committerFacundo Batista <facundobatista@gmail.com>
Sun, 22 Apr 2007 01:18:56 +0000 (01:18 +0000)
all the object methods. This is the final step to close
the #451607 bug.

Lib/test/test_socket_ssl.py

index 7b5883a80754d72457da485a69315ece5632bfb5..aab2b75d044b64c494426a023ada3587fbda3441 100644 (file)
@@ -117,6 +117,21 @@ class OpenSSLTests(unittest.TestCase):
         self.assertEqual(i, "Foo\n")
         s.close()
 
+    def testMethods(self):
+        # read & write is already tried in the Basic test
+        # now we'll try to get the server info about certificates
+        # this came from the certificate I used, one I found in /usr/share/openssl
+        info = "/C=PT/ST=Queensland/L=Lisboa/O=Neuronio, Lda./OU=Desenvolvimento/CN=brutus.neuronio.pt/emailAddress=sampo@iki.fi"
+
+        s = socket.socket()
+        s.connect(("localhost", 4433))
+        ss = socket.ssl(s)
+        cert = ss.server()
+        self.assertEqual(cert, info)
+        cert = ss.issuer()
+        self.assertEqual(cert, info)
+        s.close()
+
 
 class OpenSSLServer(threading.Thread):
     def __init__(self):