Check S3_IGNORE_SUBDOMAIN_BUCKETNAME environment variable (#3796)

* Check S3_IGNORE_SUBDOMAIN_BUCKETNAME environment variable

* move S3_IGNORE_SUBDOMAIN_BUCKETNAME environment variable to settings
This commit is contained in:
Codeglitches 2021-03-26 17:51:19 +01:00 committed by GitHub
commit 9f9716ee01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 9 deletions

View file

@ -7,6 +7,7 @@ import sure # noqa
from flask.testing import FlaskClient
import moto.server as server
from tests.compat import patch
"""
Test the different server responses
@ -56,6 +57,15 @@ def test_s3_server_bucket_create():
res.data.should.equal(b"test value")
def test_s3_server_ignore_subdomain_for_bucketnames():
with patch("moto.s3.responses.S3_IGNORE_SUBDOMAIN_BUCKETNAME", True):
test_client = authenticated_client()
res = test_client.put("/mybucket", "http://foobaz.localhost:5000/")
res.status_code.should.equal(200)
res.data.should.contain(b"mybucket")
def test_s3_server_bucket_versioning():
test_client = authenticated_client()