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 1717
1818
1919@respx .mock
20- @pytest .fixture
20+ @pytest .fixture ( autouse = True )
2121def mocked_response (respx_mock : MockRouter ) -> None :
2222 response_content = json .dumps (
2323 {'error' : {'message' : _EXPECTED_MESSAGE , 'type' : _EXPECTED_TYPE , 'data' : _EXPECTED_DATA }}
2424 )
2525 respx_mock .get (_TEST_URL ).mock (return_value = httpx .Response (400 , content = response_content ))
2626
2727
28- @pytest .mark .usefixtures ('mocked_response' )
2928def test_client_apify_api_error_with_data () -> None :
3029 """Test that client correctly throws ApifyApiError with error data from response."""
3130 client = HTTPClient ()
@@ -38,12 +37,13 @@ def test_client_apify_api_error_with_data() -> None:
3837 assert e .value .data == _EXPECTED_DATA
3938
4039
41- @pytest .mark .usefixtures ('mocked_response' )
4240async def test_async_client_apify_api_error_with_data () -> None :
4341 """Test that async client correctly throws ApifyApiError with error data from response."""
4442 client = HTTPClientAsync ()
43+
4544 with pytest .raises (ApifyApiError ) as e :
4645 await client .call (method = 'GET' , url = _TEST_URL )
46+
4747 assert e .value .message == _EXPECTED_MESSAGE
4848 assert e .value .type == _EXPECTED_TYPE
4949 assert e .value .data == _EXPECTED_DATA
You can’t perform that action at this time.
0 commit comments