Closed vlsd closed 1 year ago
your example does not meet the criteria of minimal reproducible
your example does not meet the criteria of minimal reproducible
Sorry, I typed it off the cuff. I updated it to be a proper python script.
If you compare your example and one in readme, you may find a small difference
response should be returned from request
Also, if you are only interested in request parameters, you even don't need to explicitly compare them. Just use the matcher and it will do it for you.
Oh, I see now, they just have similar variable names and I got confused. So this was never a feature. Thanks for clarifying!
It's still confusing as to why those assert statements were included in the example, they seem to simply show that the requests
library works as expected.
Also, if you are only interested in request parameters, you even don't need to explicitly compare them. Just use the matcher and it will do it for you.
What I'm interested in is obtaining the request parameters when a different piece of code makes the request. In other words, I want to test that a certain endpoint was accessed and what parameters it was accessed with.
@vlsd
to test that a certain endpoint was accessed and what parameters it was accessed with.
if you want to run a unittest against this scenario, then you need to know in advance what are the parameters that you are looking for and use the matcher. If no request with such parameters was fired, then it will raise an exception.
they seem to simply show that the
requests
library works as expected.
it is not. Since the response that you get, is the response generated by responses
library and not by requests
Describe the bug
In the readme file, it says
It even give an example of code where it runs an assert on
resp.request.params
. However, this doesn't seem to work in practice, as no matter what I try myresponse
objects do not have arequest
attribute attached, and no clear way of accessing the query parameters.I cannot tell if the documentation out of date, ahead of its time, or there's been am unexpected regression in the code.
Additional context
No response
Version of
responses
0.22.0
Steps to Reproduce
Expected Result
The following should be printed
Actual Result