File tree Expand file tree Collapse file tree 2 files changed +5
-1270
lines changed Expand file tree Collapse file tree 2 files changed +5
-1270
lines changed Original file line number Diff line number Diff line change 11import json
2+ from collections .abc import Generator
23
34import httpx
45import pytest
56import respx
6- from respx import MockRouter
77
88from apify_client ._errors import ApifyApiError
99from apify_client ._http_client import HTTPClient , HTTPClientAsync
1616}
1717
1818
19- @respx .mock
2019@pytest .fixture (autouse = True )
21- def mocked_response (respx_mock : MockRouter ) -> None :
20+ def mocked_response () -> Generator [ respx . router . MockRouter ] :
2221 response_content = json .dumps (
2322 {'error' : {'message' : _EXPECTED_MESSAGE , 'type' : _EXPECTED_TYPE , 'data' : _EXPECTED_DATA }}
2423 )
25- respx_mock .get (_TEST_URL ).mock (return_value = httpx .Response (400 , content = response_content ))
24+ with respx .mock () as respx_mock :
25+ respx_mock .get (_TEST_URL ).mock (return_value = httpx .Response (400 , content = response_content ))
26+ yield respx_mock
2627
2728
2829def test_client_apify_api_error_with_data () -> None :
You can’t perform that action at this time.
0 commit comments