Skip to content

Commit

Permalink
tests: bump min/max tls versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny authored and temoto committed Nov 18, 2021
1 parent be13bba commit 925f96f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/test_https.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def test_set_tls_version(attr, version):
def test_min_tls_version():
def setup_tls(context, server, skip_errors):
skip_errors.append("WRONG_VERSION_NUMBER")
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_1)
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain(tests.SERVER_CHAIN)
return context.wrap_socket(server, server_side=True)

http = httplib2.Http(ca_certs=tests.CA_CERTS, tls_minimum_version="TLSv1_2")
http = httplib2.Http(ca_certs=tests.CA_CERTS, tls_minimum_version="TLSv1_3")
with tests.server_const_http(tls=setup_tls) as uri:
try:
http.request(uri)
Expand All @@ -117,11 +117,11 @@ def setup_tls(context, server, skip_errors):
reason="ssl doesn't support TLS min/max",
)
def test_max_tls_version():
http = httplib2.Http(ca_certs=tests.CA_CERTS, tls_maximum_version="TLSv1")
http = httplib2.Http(ca_certs=tests.CA_CERTS, tls_maximum_version="TLSv1_2")
with tests.server_const_http(tls=True) as uri:
http.request(uri)
_, tls_ver, _ = http.connections.popitem()[1].sock.cipher()
assert tls_ver == "TLSv1.0"
assert tls_ver == "TLSv1.2"


def test_client_cert_verified():
Expand Down Expand Up @@ -162,8 +162,7 @@ def handler(request):
http = httplib2.Http(ca_certs=tests.CA_CERTS)
with tests.server_request(handler, tls=setup_tls) as uri:
uri_parsed = urllib.parse.urlparse(uri)
http.add_certificate(tests.CLIENT_ENCRYPTED_PEM, tests.CLIENT_ENCRYPTED_PEM,
uri_parsed.netloc, password="12345")
http.add_certificate(tests.CLIENT_ENCRYPTED_PEM, tests.CLIENT_ENCRYPTED_PEM, uri_parsed.netloc, password="12345")
http.request(uri)

assert len(cert_log) == 1
Expand Down

0 comments on commit 925f96f

Please sign in to comment.