getsentry / responses

A utility for mocking out the Python Requests library.
Apache License 2.0
4.17k stars 355 forks source link

Documentation lacking information #729

Closed developer992 closed 3 months ago

developer992 commented 4 months ago

Describe the bug

Cannot find information

Additional context

I am missing some basics, like

I needed to change the code and fix some tests by changing the urls it calls and now i'm getting

the call doesn't match any registered mock

I would assume i'd need to re-record the responses ... delete the saved responses and re-start the process but how?

I am reading Record responses to files but my project (i've adopted it, just need to fix a few things ) doesn't have any yaml files, so apparently this isn't cached?

so how does it know the url doesn't match?

Version of responses

0.21.0

Steps to Reproduce

tests/test_service_v2.py:

test_count_with_chainable_filter_multiple

Change f"{service.url}/Employees/$count?%24filter=ID%20eq%2023%20and%20NickName%20eq%20%27Steve%27",

to f"{service.url}/Employees%2F%24count%3F%24filter%3D(ID%20eq%2023)%20and%20(NickName%20eq%20%27Steve%27)"

Rerun tests

Result:

FAILED tests/test_service_v2.py::test_count_with_chainable_filter_multiple - requests.exceptions.ConnectionError: Connection refused by Responses - the call doesn't match any registered mock.

Expected Result

...

Actual Result

FAILED tests/test_service_v2.py::test_count_with_chainable_filter_multiple - requests.exceptions.ConnectionError: Connection refused by Responses - the call doesn't match any registered mock.

markstory commented 4 months ago

It sounds like you're changing a URL in the application code, and need to update the response mock for the old URL to reflect the changes in the URL. I can't help much beyond that as I don't know what is in tests/test_service_v2.py. However, within the test_count_with_chainable_filter_multiple (or a setup hook) there is a responses.add() call for the old URL that needs to be updated.

getsantry[bot] commented 3 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀