diff --git a/moto/route53/responses.py b/moto/route53/responses.py index 647166fd1..4c43eddf3 100644 --- a/moto/route53/responses.py +++ b/moto/route53/responses.py @@ -81,6 +81,9 @@ class Route53(BaseResponse): delegation_set_id=delegation_set_id, ) template = Template(CREATE_HOSTED_ZONE_RESPONSE) + headers = { + "Location": f"https://route53.amazonaws.com/2013-04-01/hostedzone/{new_zone.id}" + } return 201, headers, template.render(zone=new_zone) elif request.method == "GET": diff --git a/tests/test_route53/test_route53.py b/tests/test_route53/test_route53.py index 03fc53161..67538b09b 100644 --- a/tests/test_route53/test_route53.py +++ b/tests/test_route53/test_route53.py @@ -5,8 +5,9 @@ import sure # noqa # pylint: disable=unused-import import botocore import pytest +import requests -from moto import mock_ec2, mock_route53 +from moto import mock_ec2, mock_route53, settings @mock_route53 @@ -28,6 +29,10 @@ def test_create_hosted_zone(): delegation["NameServers"].should.contain("ns-2050.awsdns-66.org") delegation["NameServers"].should.contain("ns-2051.awsdns-67.co.uk") + location = response["Location"] + if not settings.TEST_SERVER_MODE: + assert "testdns.aws.com." in requests.get(location).text + @mock_route53 def test_list_hosted_zones(): @@ -481,7 +486,6 @@ def test_list_or_change_tags_for_resource_request(): @mock_ec2 @mock_route53 def test_list_hosted_zones_by_name(): - # Create mock VPC so we can get a VPC ID ec2c = boto3.client("ec2", region_name="us-east-1") vpc_id = ec2c.create_vpc(CidrBlock="10.1.0.0/16").get("Vpc").get("VpcId")