mirror of https://github.com/python/cpython.git
Silence the altered state warning about threadgs when running test_httplib.
This commit is contained in:
parent
40ccea7e1e
commit
252365bab8
|
@ -506,8 +506,7 @@ def test_networked_bad_cert(self):
|
||||||
def test_local_good_hostname(self):
|
def test_local_good_hostname(self):
|
||||||
# The (valid) cert validates the HTTP hostname
|
# The (valid) cert validates the HTTP hostname
|
||||||
import ssl
|
import ssl
|
||||||
from test.ssl_servers import make_https_server
|
server = self.make_server(CERT_localhost)
|
||||||
server = make_https_server(self, CERT_localhost)
|
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||||
context.verify_mode = ssl.CERT_REQUIRED
|
context.verify_mode = ssl.CERT_REQUIRED
|
||||||
context.load_verify_locations(CERT_localhost)
|
context.load_verify_locations(CERT_localhost)
|
||||||
|
@ -515,12 +514,12 @@ def test_local_good_hostname(self):
|
||||||
h.request('GET', '/nonexistent')
|
h.request('GET', '/nonexistent')
|
||||||
resp = h.getresponse()
|
resp = h.getresponse()
|
||||||
self.assertEqual(resp.status, 404)
|
self.assertEqual(resp.status, 404)
|
||||||
|
del server
|
||||||
|
|
||||||
def test_local_bad_hostname(self):
|
def test_local_bad_hostname(self):
|
||||||
# The (valid) cert doesn't validate the HTTP hostname
|
# The (valid) cert doesn't validate the HTTP hostname
|
||||||
import ssl
|
import ssl
|
||||||
from test.ssl_servers import make_https_server
|
server = self.make_server(CERT_fakehostname)
|
||||||
server = make_https_server(self, CERT_fakehostname)
|
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||||
context.verify_mode = ssl.CERT_REQUIRED
|
context.verify_mode = ssl.CERT_REQUIRED
|
||||||
context.load_verify_locations(CERT_fakehostname)
|
context.load_verify_locations(CERT_fakehostname)
|
||||||
|
@ -538,6 +537,7 @@ def test_local_bad_hostname(self):
|
||||||
h.request('GET', '/nonexistent')
|
h.request('GET', '/nonexistent')
|
||||||
resp = h.getresponse()
|
resp = h.getresponse()
|
||||||
self.assertEqual(resp.status, 404)
|
self.assertEqual(resp.status, 404)
|
||||||
|
del server
|
||||||
|
|
||||||
|
|
||||||
class RequestBodyTest(TestCase):
|
class RequestBodyTest(TestCase):
|
||||||
|
|
Loading…
Reference in New Issue