Added support to get_all_security_groups endpoint to actually filter groups.
- Filters by groupnames, group_ids and a filters. However, the filters option doesn't support owner-id and tags since neither attribute was readily available via the SecurityGroup object. - Also included a basic test to confirm it works.
This commit is contained in:
parent
a3b02f3f8b
commit
665beda466
3 changed files with 97 additions and 3 deletions
|
|
@ -195,3 +195,22 @@ def test_authorize_group_in_vpc():
|
|||
# And check that it gets revoked
|
||||
security_group = [group for group in conn.get_all_security_groups() if group.name == 'test1'][0]
|
||||
security_group.rules.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_get_all_security_groups():
|
||||
conn = boto.connect_ec2()
|
||||
conn.create_security_group(name='test1', description='test1', vpc_id='vpc-mjm05d27')
|
||||
conn.create_security_group(name='test2', description='test2')
|
||||
|
||||
resp = conn.get_all_security_groups(groupnames=['test1'])
|
||||
resp.should.have.length_of(1)
|
||||
|
||||
resp = conn.get_all_security_groups(filters={'vpc_id': ['vpc-mjm05d27']})
|
||||
resp.should.have.length_of(1)
|
||||
|
||||
resp = conn.get_all_security_groups(filters={'description': ['test1']})
|
||||
resp.should.have.length_of(1)
|
||||
|
||||
resp = conn.get_all_security_groups()
|
||||
resp.should.have.length_of(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue