File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 17
17
18
18
19
19
@respx .mock
20
- @pytest .fixture
20
+ @pytest .fixture ( autouse = True )
21
21
def mocked_response (respx_mock : MockRouter ) -> None :
22
22
response_content = json .dumps (
23
23
{'error' : {'message' : _EXPECTED_MESSAGE , 'type' : _EXPECTED_TYPE , 'data' : _EXPECTED_DATA }}
24
24
)
25
25
respx_mock .get (_TEST_URL ).mock (return_value = httpx .Response (400 , content = response_content ))
26
26
27
27
28
- @pytest .mark .usefixtures ('mocked_response' )
29
28
def test_client_apify_api_error_with_data () -> None :
30
29
"""Test that client correctly throws ApifyApiError with error data from response."""
31
30
client = HTTPClient ()
@@ -38,12 +37,13 @@ def test_client_apify_api_error_with_data() -> None:
38
37
assert e .value .data == _EXPECTED_DATA
39
38
40
39
41
- @pytest .mark .usefixtures ('mocked_response' )
42
40
async def test_async_client_apify_api_error_with_data () -> None :
43
41
"""Test that async client correctly throws ApifyApiError with error data from response."""
44
42
client = HTTPClientAsync ()
43
+
45
44
with pytest .raises (ApifyApiError ) as e :
46
45
await client .call (method = 'GET' , url = _TEST_URL )
46
+
47
47
assert e .value .message == _EXPECTED_MESSAGE
48
48
assert e .value .type == _EXPECTED_TYPE
49
49
assert e .value .data == _EXPECTED_DATA
You can’t perform that action at this time.
0 commit comments