S3 LocationConstraint test can only be run in non-ServerMode

This commit is contained in:
Bert Blommers 2020-02-02 12:45:57 +00:00
parent d5a36752d7
commit ceb16b00a7

View File

@ -1118,17 +1118,22 @@ def test_bucket_location_nondefault():
) )
@mock_s3 # Test uses current Region to determine whether to throw an error
def test_s3_location_should_error_outside_useast1(): # Region is retrieved based on current URL
s3 = boto3.client("s3", region_name="eu-west-1") # URL will always be localhost in Server Mode, so can't run it there
if not settings.TEST_SERVER_MODE:
bucket_name = "asdfasdfsdfdsfasda" @mock_s3
def test_s3_location_should_error_outside_useast1():
s3 = boto3.client("s3", region_name="eu-west-1")
with assert_raises(ClientError) as e: bucket_name = "asdfasdfsdfdsfasda"
s3.create_bucket(Bucket=bucket_name)
e.exception.response["Error"]["Message"].should.equal( with assert_raises(ClientError) as e:
"The unspecified location constraint is incompatible for the region specific endpoint this request was sent to." s3.create_bucket(Bucket=bucket_name)
) e.exception.response["Error"]["Message"].should.equal(
"The unspecified location constraint is incompatible for the region specific endpoint this request was sent to."
)
@mock_s3_deprecated @mock_s3_deprecated