Fix:EC2 Tags in create vpc and create subnet (#3338)
Co-authored-by: usmankb <usman@krazybee.com>
This commit is contained in:
parent
82dbaadfc4
commit
55e7caccfe
5 changed files with 69 additions and 2 deletions
|
|
@ -327,7 +327,7 @@ def test_create_subnet_response_fields():
|
|||
subnet.should.have.key("State")
|
||||
subnet.should.have.key("SubnetId")
|
||||
subnet.should.have.key("VpcId")
|
||||
subnet.shouldnt.have.key("Tags")
|
||||
subnet.should.have.key("Tags")
|
||||
subnet.should.have.key("DefaultForAz").which.should.equal(False)
|
||||
subnet.should.have.key("MapPublicIpOnLaunch").which.should.equal(False)
|
||||
subnet.should.have.key("OwnerId")
|
||||
|
|
@ -456,6 +456,23 @@ def test_create_subnets_with_overlapping_cidr_blocks():
|
|||
)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_subnet_with_tags():
|
||||
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
||||
vpc = ec2.create_vpc(CidrBlock="172.31.0.0/16")
|
||||
|
||||
subnet = ec2.create_subnet(
|
||||
VpcId=vpc.id,
|
||||
CidrBlock="172.31.48.0/20",
|
||||
AvailabilityZoneId="use1-az6",
|
||||
TagSpecifications=[
|
||||
{"ResourceType": "subnet", "Tags": [{"Key": "name", "Value": "some-vpc"}]}
|
||||
],
|
||||
)
|
||||
|
||||
assert subnet.tags == [{"Key": "name", "Value": "some-vpc"}]
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_available_ip_addresses_in_subnet():
|
||||
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
||||
|
|
|
|||
|
|
@ -680,6 +680,19 @@ def test_create_vpc_with_invalid_cidr_range():
|
|||
)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_vpc_with_tags():
|
||||
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
||||
# Create VPC
|
||||
vpc = ec2.create_vpc(
|
||||
CidrBlock="10.0.0.0/16",
|
||||
TagSpecifications=[
|
||||
{"ResourceType": "vpc", "Tags": [{"Key": "name", "Value": "some-vpc"}]}
|
||||
],
|
||||
)
|
||||
assert vpc.tags == [{"Key": "name", "Value": "some-vpc"}]
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_enable_vpc_classic_link():
|
||||
ec2 = boto3.resource("ec2", region_name="us-west-1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue