diff --git a/moto/ec2/models.py b/moto/ec2/models.py index ce2e0871..e3a82895 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -2465,7 +2465,7 @@ class EC2Backend(BaseBackend, InstanceBackend, TagBackend, AmiBackend, elif resource_prefix == EC2_RESOURCE_TO_PREFIX['reserved-instance']: self.raise_not_implemented_error('DescribeReservedInstances') elif resource_prefix == EC2_RESOURCE_TO_PREFIX['route-table']: - self.raise_not_implemented_error('DescribeRouteTables') + self.get_route_table(route_table_id=resource_id) elif resource_prefix == EC2_RESOURCE_TO_PREFIX['security-group']: self.describe_security_groups(group_ids=[resource_id]) elif resource_prefix == EC2_RESOURCE_TO_PREFIX['snapshot']: diff --git a/moto/ec2/responses/route_tables.py b/moto/ec2/responses/route_tables.py index ae9abff4..f583cbbf 100644 --- a/moto/ec2/responses/route_tables.py +++ b/moto/ec2/responses/route_tables.py @@ -121,7 +121,16 @@ CREATE_ROUTE_TABLE_RESPONSE = """ {% endfor %} - + + {% for tag in route_table.get_tags() %} + + {{ tag.resource_id }} + {{ tag.resource_type }} + {{ tag.key }} + {{ tag.value }} + + {% endfor %} + """ @@ -172,6 +181,16 @@ DESCRIBE_ROUTE_TABLES_RESPONSE = """ {% endfor %} + + {% for tag in route_table.get_tags() %} + + {{ tag.resource_id }} + {{ tag.resource_type }} + {{ tag.key }} + {{ tag.value }} + + {% endfor %} + {% endfor %} diff --git a/tests/test_ec2/test_route_tables.py b/tests/test_ec2/test_route_tables.py index c6c19912..e31d3412 100644 --- a/tests/test_ec2/test_route_tables.py +++ b/tests/test_ec2/test_route_tables.py @@ -418,3 +418,22 @@ def test_routes_vpc_peering_connection(): new_route.state.should.equal('blackhole') new_route.destination_cidr_block.should.equal(ROUTE_CIDR) + +@mock_ec2 +def test_network_acl_tagging(): + + conn = boto.connect_vpc('the_key', 'the secret') + vpc = conn.create_vpc("10.0.0.0/16") + + route_table = conn.create_route_table(vpc.id) + route_table.add_tag("a key", "some value") + + tag = conn.get_all_tags()[0] + tag.name.should.equal("a key") + tag.value.should.equal("some value") + + all_route_tables = conn.get_all_route_tables() + test_route_table = next(na for na in all_route_tables + if na.id == route_table.id) + test_route_table.tags.should.have.length_of(1) + test_route_table.tags["a key"].should.equal("some value") \ No newline at end of file