diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit/test_core.py --- httpretty-1.0.2/tests/unit/test_core.py.orig 2020-03-20 01:54:16.000000000 +0100 +++ httpretty-1.0.2/tests/unit/test_core.py 2020-03-27 11:14:13.000000000 +0100 @@ -190,28 +190,35 @@ def test_fake_ssl_socket_proxies_its_ow_ @freeze_time("2013-10-04 04:20:00") def test_fakesock_socket_getpeercert(): ("fakesock.socket#getpeercert should return a hardcoded fake certificate") - # Given a fake socket instance - socket = fakesock.socket() - # And that it's bound to some host - socket._host = 'somewhere.com' + # Don't bother with an actual remote roundtrip + httpretty.allow_net_connect = False - # When I retrieve the peer certificate - certificate = socket.getpeercert() + try: + # Given a fake socket instance + socket = fakesock.socket() - # Then it should return a hardcoded value - certificate.should.equal({ - u'notAfter': 'Sep 29 04:20:00 GMT', - u'subject': ( - ((u'organizationName', u'*.somewhere.com'),), - ((u'organizationalUnitName', u'Domain Control Validated'),), - ((u'commonName', u'*.somewhere.com'),)), - u'subjectAltName': ( - (u'DNS', u'*.somewhere.com'), - (u'DNS', u'somewhere.com'), - (u'DNS', u'*') - ) - }) + # And that it's bound to some host + socket._host = 'somewhere.com' + + # When I retrieve the peer certificate + certificate = socket.getpeercert() + + # Then it should return a hardcoded value + certificate.should.equal({ + u'notAfter': 'Sep 29 04:20:00 GMT', + u'subject': ( + ((u'organizationName', u'*.somewhere.com'),), + ((u'organizationalUnitName', u'Domain Control Validated'),), + ((u'commonName', u'*.somewhere.com'),)), + u'subjectAltName': ( + (u'DNS', u'*.somewhere.com'), + (u'DNS', u'somewhere.com'), + (u'DNS', u'*') + ) + }) + finally: + httpretty.allow_net_connect = True def test_fakesock_socket_ssl():