allow get_filter_value to return state of ami and test
* updated Ami.get_filter_value to return the state value of the AMI * updated test_ec2.test_amis.test_ami_filters to test for AMIs in the state of 'available'
This commit is contained in:
parent
2650d9981f
commit
866d8b4ea8
@ -604,6 +604,8 @@ class Ami(TaggedEC2Instance):
|
|||||||
return getattr(self,filter_name)
|
return getattr(self,filter_name)
|
||||||
elif filter_name == 'image-id':
|
elif filter_name == 'image-id':
|
||||||
return self.id
|
return self.id
|
||||||
|
elif filter_name == 'state':
|
||||||
|
return self.state
|
||||||
else:
|
else:
|
||||||
ec2_backend.raise_not_implemented_error("The filter '{0}' for DescribeImages".format(filter_name))
|
ec2_backend.raise_not_implemented_error("The filter '{0}' for DescribeImages".format(filter_name))
|
||||||
|
|
||||||
|
@ -132,6 +132,9 @@ def test_ami_filters():
|
|||||||
amis_by_id = conn.get_all_images(filters={'image-id': imageA.id})
|
amis_by_id = conn.get_all_images(filters={'image-id': imageA.id})
|
||||||
set([ami.id for ami in amis_by_id]).should.equal(set([imageA.id]))
|
set([ami.id for ami in amis_by_id]).should.equal(set([imageA.id]))
|
||||||
|
|
||||||
|
amis_by_id = conn.get_all_images(filters={'state': 'available'})
|
||||||
|
set([ami.id for ami in amis_by_id]).should.equal(set([imageA.id]))
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_getting_missing_ami():
|
def test_getting_missing_ami():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user