88from hyper .common .connection import HTTPConnection
99from hyper .compat import ssl
1010
11- import pytest
12-
1311
1412TEST_DIR = os .path .abspath (os .path .dirname (__file__ ))
1513TEST_CERTS_DIR = os .path .join (TEST_DIR , 'certs' )
@@ -25,11 +23,10 @@ class TestSSLContext(object):
2523 def test_default_context (self ):
2624 # Create default SSLContext
2725 hyper .tls ._context = hyper .tls .init_context ()
28- assert hyper .tls ._context .check_hostname == True
26+ assert hyper .tls ._context .check_hostname
2927 assert hyper .tls ._context .verify_mode == ssl .CERT_REQUIRED
3028 assert hyper .tls ._context .options & ssl .OP_NO_COMPRESSION != 0
3129
32-
3330 def test_custom_context (self ):
3431 # The following SSLContext doesn't provide any valid certicate.
3532 # Its purpose is only to confirm that hyper is not using its
@@ -40,11 +37,10 @@ def test_custom_context(self):
4037
4138 hyper .tls ._context = context
4239
43- assert hyper .tls ._context .check_hostname == False
40+ assert not hyper .tls ._context .check_hostname
4441 assert hyper .tls ._context .verify_mode == ssl .CERT_NONE
4542 assert hyper .tls ._context .options & ssl .OP_NO_COMPRESSION == 0
4643
47-
4844 def test_HTTPConnection_with_custom_context (self ):
4945 context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
5046 context .set_default_verify_paths ()
@@ -55,13 +51,12 @@ def test_HTTPConnection_with_custom_context(self):
5551
5652 conn = HTTPConnection ('http2bin.org' , 443 , ssl_context = context )
5753
58- assert conn .ssl_context .check_hostname == True
54+ assert conn .ssl_context .check_hostname
5955 assert conn .ssl_context .verify_mode == ssl .CERT_REQUIRED
6056 assert conn .ssl_context .options & ssl .OP_NO_COMPRESSION != 0
6157
62-
6358 def test_client_certificates (self ):
64- context = hyper .tls .init_context (
59+ hyper .tls .init_context (
6560 cert = (CLIENT_CERT_FILE , CLIENT_KEY_FILE ),
6661 cert_password = b'abc123' )
67- context = hyper .tls .init_context (cert = CLIENT_PEM_FILE )
62+ hyper .tls .init_context (cert = CLIENT_PEM_FILE )
0 commit comments