moto/tests/test_core/test_request_mocking.py
Steve Pulec c7147b06b1 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
2019-07-10 21:59:25 -05:00

22 lines
528 B
Python

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