Skip to content

Commit

Permalink
Support 'no verify' SSL mode
Browse files Browse the repository at this point in the history
aiohttp calls 'set_default_verify_paths' on the SSL context
object
https://github.com/aio-libs/aiohttp/blob/v3.9.1/aiohttp/connector.py#L935
  • Loading branch information
ento authored and mindflayer committed Jan 16, 2024
1 parent c634dc5 commit 0307301
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions mocket/mocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class FakeSSLContext(SuperFakeSSLContext):
"load_verify_locations",
"set_alpn_protocols",
"set_ciphers",
"set_default_verify_paths",
)
sock = None
post_handshake_auth = None
Expand Down
8 changes: 8 additions & 0 deletions tests/tests38/test_http_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ async def test_https_session(self):

self.assertEqual(len(Mocket.request_list()), 2)

@async_mocketize
async def test_no_verify(self):
Entry.single_register(Entry.GET, self.target_url, status=404)

async with aiohttp.ClientSession(timeout=self.timeout) as session:
async with session.get(self.target_url, ssl=False) as get_response:
assert get_response.status == 404

@async_httprettified
async def test_httprettish_session(self):
HTTPretty.register_uri(
Expand Down

0 comments on commit 0307301

Please sign in to comment.