2019-07-11 02:59:25 +00:00
|
|
|
import requests
|
2020-10-06 06:04:09 +00:00
|
|
|
import pytest
|
2019-07-11 02:59:25 +00:00
|
|
|
import sure # noqa
|
|
|
|
|
|
|
|
import boto3
|
2019-07-11 03:45:26 +00:00
|
|
|
from moto import mock_sqs, settings
|
2019-07-11 02:59:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
@mock_sqs
|
2020-10-06 06:04:09 +00:00
|
|
|
@pytest.mark.network
|
2019-07-11 02:59:25 +00:00
|
|
|
def test_passthrough_requests():
|
2019-10-31 15:44:26 +00:00
|
|
|
conn = boto3.client("sqs", region_name="us-west-1")
|
2019-07-11 02:59:25 +00:00
|
|
|
conn.create_queue(QueueName="queue1")
|
|
|
|
|
|
|
|
res = requests.get("https://httpbin.org/ip")
|
|
|
|
assert res.status_code == 200
|
|
|
|
|
|
|
|
|
2019-07-11 15:09:01 +00:00
|
|
|
if not settings.TEST_SERVER_MODE:
|
2019-10-31 15:44:26 +00:00
|
|
|
|
2019-07-11 03:45:26 +00:00
|
|
|
@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
|