Added the ability to filter vpcs by tags.
This commit is contained in:
parent
ecb23485d0
commit
89bd78b927
2 changed files with 36 additions and 4 deletions
|
|
@ -110,4 +110,22 @@ def test_vpc_get_by_dhcp_options_id():
|
|||
vpcs.should.have.length_of(2)
|
||||
vpc_ids = map(lambda v: v.id, vpcs)
|
||||
vpc1.id.should.be.within(vpc_ids)
|
||||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_vpc_get_by_tag():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
vpc2 = conn.create_vpc("10.0.0.0/16")
|
||||
vpc3 = conn.create_vpc("10.0.0.0/24")
|
||||
|
||||
vpc1.add_tag('Name', 'TestVPC')
|
||||
vpc2.add_tag('Name', 'TestVPC')
|
||||
vpc3.add_tag('Name', 'TestVPC2')
|
||||
|
||||
vpcs = conn.get_all_vpcs(filters={'tag:Name': 'TestVPC'})
|
||||
vpcs.should.have.length_of(2)
|
||||
vpc_ids = map(lambda v: v.id, vpcs)
|
||||
vpc1.id.should.be.within(vpc_ids)
|
||||
vpc2.id.should.be.within(vpc_ids)
|
||||
Loading…
Add table
Add a link
Reference in a new issue