Created
September 5, 2023 02:54
-
-
Save whchi/5bf4adefdc217fe0e9c069e75b40de84 to your computer and use it in GitHub Desktop.
mock httpx in pytest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @patch('httpx.put') | |
| def test_update_application_basic_info(mock_put): | |
| mock_response = mock.Mock() | |
| mock_response.status_code = 200 | |
| mock_response.json.return_value = {'data': {'ec_add_on_id': 123}} | |
| mock_put.return_value = mock_response | |
| ... | |
| mock_put.assert_called_once() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment