Fix:Added Tags for Network-ACL,RouteTable,InternetGateway (#3430)
* Fix:Added Tags for Network-ACL,RouteTable,InternetGateway * Modified internet-gateway tags * Lint Co-authored-by: usmankb <usman@krazybee.com>
This commit is contained in:
parent
171130fe7b
commit
f57a77451c
7 changed files with 83 additions and 8 deletions
|
|
@ -7,11 +7,13 @@ from nose.tools import assert_raises
|
|||
import re
|
||||
|
||||
import boto
|
||||
import boto3
|
||||
|
||||
from boto.exception import EC2ResponseError
|
||||
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2_deprecated
|
||||
from moto import mock_ec2_deprecated, mock_ec2
|
||||
|
||||
|
||||
VPC_CIDR = "10.0.0.0/16"
|
||||
|
|
@ -269,3 +271,19 @@ def test_igw_filter_by_attachment_state():
|
|||
result = conn.get_all_internet_gateways(filters={"attachment.state": "available"})
|
||||
result.should.have.length_of(1)
|
||||
result[0].id.should.equal(igw1.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_internet_gateway_with_tags():
|
||||
ec2 = boto3.resource("ec2", region_name="eu-central-1")
|
||||
|
||||
igw = ec2.create_internet_gateway(
|
||||
TagSpecifications=[
|
||||
{
|
||||
"ResourceType": "internet-gateway",
|
||||
"Tags": [{"Key": "test", "Value": "TestRouteTable"}],
|
||||
}
|
||||
],
|
||||
)
|
||||
igw.tags.should.have.length_of(1)
|
||||
igw.tags.should.equal([{"Key": "test", "Value": "TestRouteTable"}])
|
||||
|
|
|
|||
|
|
@ -304,3 +304,26 @@ def test_describe_network_acls():
|
|||
"An error occurred (InvalidRouteTableID.NotFound) when calling the "
|
||||
"DescribeNetworkAcls operation: The routeTable ID '1' does not exist"
|
||||
)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_network_acl_with_tags():
|
||||
conn = boto3.client("ec2", region_name="us-west-2")
|
||||
|
||||
vpc = conn.create_vpc(CidrBlock="10.0.0.0/16")
|
||||
vpc_id = vpc["Vpc"]["VpcId"]
|
||||
|
||||
network_acl = conn.create_network_acl(
|
||||
VpcId=vpc_id,
|
||||
TagSpecifications=[
|
||||
{
|
||||
"ResourceType": "network-acl",
|
||||
"Tags": [{"Key": "test", "Value": "TestTags"}],
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
(len(network_acl.get("NetworkAcl").get("Tags"))).should.equal(1)
|
||||
network_acl.get("NetworkAcl").get("Tags").should.equal(
|
||||
[{"Key": "test", "Value": "TestTags"}]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -715,3 +715,22 @@ def test_create_vpc_end_point():
|
|||
)
|
||||
vpc_end_point["VpcEndpoint"]["VpcId"].should.equal(vpc["Vpc"]["VpcId"])
|
||||
len(vpc_end_point["VpcEndpoint"]["DnsEntries"]).should.be.greater_than(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_route_tables_with_tags():
|
||||
ec2 = boto3.resource("ec2", region_name="eu-central-1")
|
||||
|
||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||
|
||||
route_table = ec2.create_route_table(
|
||||
VpcId=vpc.id,
|
||||
TagSpecifications=[
|
||||
{
|
||||
"ResourceType": "route-table",
|
||||
"Tags": [{"Key": "test", "Value": "TestRouteTable"}],
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
route_table.tags.should.have.length_of(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue