Closed risky-rickman closed 4 months ago
I am unable to reproduce your issue locally. However, I don't know what happens inside of main()
could you provide a smaller example that I could run locally to reproduce the problem you're seeing?
I was able to isolate the issue a bit more. It looks like the responses library has issues working with the aws mock library.
import responses
import os
import moto
import requests
@responses.activate
def test():
# AWS mock start
moto_fake = moto.mock_aws()
moto_fake.start()
# Monkey patch refresh api call
responses.add(responses.POST, "http://mock", status=200, json={"a": "b"})
response = requests.request(
"POST",
"http://mock",
data={"projectId": 1},
)
assert len(responses.calls) == 1
test()
moto
has its own nuances. Especially, how to combine it with responses.
They did a great job documenting it, please see the link: https://docs.getmoto.org/en/latest/docs/faq.html#how-can-i-mock-my-own-http-requests-using-the-responses-module
Thanks for the info! I'll give this a try and close out the ticket if it works.
Works like a charm!
Describe the bug
I am able to successfully mock my api call, however when i check the responses.calls iterable, it is empty.
Additional context
No response
Version of
responses
0.25.03
Steps to Reproduce
Expected Result
I should be able to inspect the details of the call with responses.calls[1]
Actual Result
the responses.calls iterable is empty