I'm currently trying to do unit tests using the requests_mock library in order to patch requests. I've written the following code:
def test_general_search(requests_mock):
params = {'query': 'testsetset', 'exact': 0, 'max_pages': '1', 'category': 'username'}
requests_mock.get(f'{MOCK_ADDRESS}', json=MOCK_RESPONSE)
client = Client(MOCK_ADDRESS, auth=MOCK_CREDS, headers=MOCK_HEADERS)
res = general_search(client, params)
assert ...
But I am getting the following error:
requests_mock.exceptions.NoMockAddress: No mock address: GET https://fake-url.com/search?query=username%3Atestsetset&page=1
Can anyone help me out with figuring out how to solve it? I've used mock as a pytest feature.