Cleanup responses mocking. Closes #1567
This unblocks requests to other websites with requests while Moto is activated. It also adds a wildcard for AWS services to still ensure no accidental requests are made for unmocked services
This commit is contained in:
parent
12aa5dddf7
commit
c7147b06b1
3 changed files with 59 additions and 51 deletions
21
tests/test_core/test_request_mocking.py
Normal file
21
tests/test_core/test_request_mocking.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import requests
|
||||
import sure # noqa
|
||||
|
||||
import boto3
|
||||
from moto import mock_sqs
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_passthrough_requests():
|
||||
conn = boto3.client("sqs", region_name='us-west-1')
|
||||
conn.create_queue(QueueName="queue1")
|
||||
|
||||
res = requests.get("https://httpbin.org/ip")
|
||||
assert res.status_code == 200
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_requests_to_amazon_subdomains_dont_work():
|
||||
res = requests.get("https://fakeservice.amazonaws.com/foo/bar")
|
||||
assert res.content == b"The method is not implemented"
|
||||
assert res.status_code == 400
|
||||
Loading…
Add table
Add a link
Reference in a new issue