Skip to content

Commit

Permalink
HH-230352 upgrade test mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
712u3 committed Sep 17, 2024
1 parent de0d2ff commit e6f9965
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 353 deletions.
12 changes: 6 additions & 6 deletions frontik/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from typing import Any, Optional, Union

import pytest
from aioresponses import aioresponses
from http_client import AIOHttpClientWrapper
from http_client.request_response import RequestBuilder, RequestResult
from http_client.testing import MockHttpClient
from lxml import etree
from tornado.escape import utf8
from tornado.httpserver import HTTPServer
Expand Down Expand Up @@ -68,10 +68,10 @@ async def _finish_server_setup(
patch_http_client(self.http_client, fail_on_unknown=False)

@pytest.fixture(autouse=True)
def setup_mock_client(self, passthrow_hosts):
with aioresponses(passthrough=passthrow_hosts) as mock_client:
self.mock_client = mock_client
yield self.mock_client
def setup_mock_http_client(self, passthrow_hosts):
with MockHttpClient(passthrough=passthrow_hosts) as mock_http_client:
self.mock_http_client = mock_http_client
yield self.mock_http_client

@pytest.fixture()
def passthrow_hosts(self):
Expand Down Expand Up @@ -204,7 +204,7 @@ def set_stub_new(
if response_headers is not None:
headers.update(response_headers)

self.mock_client.add(
self.mock_http_client.add(
url,
method=request_method,
status=response_code,
Expand Down
Loading

0 comments on commit e6f9965

Please sign in to comment.