From 2584e22b659490ffccb179596d6bb6cca63250ae Mon Sep 17 00:00:00 2001 From: Giorgio Salluzzo Date: Mon, 16 Sep 2024 09:27:41 +0200 Subject: [PATCH] Fix for tests. --- mocket/mocket.py | 3 ++- tests/main/test_http.py | 12 ++++++++++-- tests/main/test_http_with_xxhash.py | 12 ++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mocket/mocket.py b/mocket/mocket.py index 25f4b55c..daa0e608 100644 --- a/mocket/mocket.py +++ b/mocket/mocket.py @@ -83,6 +83,7 @@ def __set__(self, *args): minimum_version = FakeSetter() options = FakeSetter() verify_mode = FakeSetter() + verify_flags = FakeSetter() class FakeSSLContext(SuperFakeSSLContext): @@ -102,7 +103,7 @@ def check_hostname(self): return self._check_hostname @check_hostname.setter - def check_hostname(self, *args): + def check_hostname(self, _): self._check_hostname = False def __init__(self, sock=None, server_hostname=None, _context=None, *args, **kwargs): diff --git a/tests/main/test_http.py b/tests/main/test_http.py index 21fe448d..d335bcc5 100644 --- a/tests/main/test_http.py +++ b/tests/main/test_http.py @@ -308,10 +308,18 @@ def test_request_bodies(self): @mocketize(truesocket_recording_dir=os.path.dirname(__file__)) def test_truesendall_with_dump_from_recording(self): requests.get( - "http://httpbin.local/ip", headers={"user-agent": "Fake-User-Agent"} + "http://httpbin.local/ip", + headers={ + "user-agent": "Fake-User-Agent", + "Accept-Encoding": "gzip, deflate, zstd", + }, ) requests.get( - "http://httpbin.local/gzip", headers={"user-agent": "Fake-User-Agent"} + "http://httpbin.local/gzip", + headers={ + "user-agent": "Fake-User-Agent", + "Accept-Encoding": "gzip, deflate, zstd", + }, ) dump_filename = os.path.join( diff --git a/tests/main/test_http_with_xxhash.py b/tests/main/test_http_with_xxhash.py index 4600bf37..a074a864 100644 --- a/tests/main/test_http_with_xxhash.py +++ b/tests/main/test_http_with_xxhash.py @@ -11,10 +11,18 @@ class HttpEntryTestCase(HttpTestCase): @mocketize(truesocket_recording_dir=os.path.dirname(__file__)) def test_truesendall_with_dump_from_recording(self): requests.get( - "http://httpbin.local/ip", headers={"user-agent": "Fake-User-Agent"} + "http://httpbin.local/ip", + headers={ + "user-agent": "Fake-User-Agent", + "Accept-Encoding": "gzip, deflate, zstd", + }, ) requests.get( - "http://httpbin.local/gzip", headers={"user-agent": "Fake-User-Agent"} + "http://httpbin.local/gzip", + headers={ + "user-agent": "Fake-User-Agent", + "Accept-Encoding": "gzip, deflate, zstd", + }, ) dump_filename = os.path.join(