diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-09 20:21:19 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-09 20:21:19 (GMT) |
commit | fb0469112f2e027833a1dc7ff4c678417de0111a (patch) | |
tree | ac086511b8885cf056a2bdc453087a731f9d82c9 /Lib/test/test_ssl.py | |
parent | 859c4ef0a0069a555057f25f02407e89bd2c114b (diff) | |
download | cpython-fb0469112f2e027833a1dc7ff4c678417de0111a.zip cpython-fb0469112f2e027833a1dc7ff4c678417de0111a.tar.gz cpython-fb0469112f2e027833a1dc7ff4c678417de0111a.tar.bz2 |
Issue #10022: The dictionary returned by the `getpeercert()` method
of SSL sockets now has additional items such as `issuer` and `notBefore`.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index bb9cebf..df9b987 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -109,7 +109,7 @@ class BasicSocketTests(unittest.TestCase): # note that this uses an 'unofficial' function in _ssl.c, # provided solely for this test, to exercise the certificate # parsing code - p = ssl._ssl._test_decode_cert(CERTFILE, False) + p = ssl._ssl._test_decode_cert(CERTFILE) if support.verbose: sys.stdout.write("\n" + pprint.pformat(p) + "\n") @@ -1059,6 +1059,11 @@ else: self.fail( "Missing or invalid 'organizationName' field in certificate subject; " "should be 'Python Software Foundation'.") + self.assertIn('notBefore', cert) + self.assertIn('notAfter', cert) + before = ssl.cert_time_to_seconds(cert['notBefore']) + after = ssl.cert_time_to_seconds(cert['notAfter']) + self.assertLess(before, after) s.close() finally: server.stop() |