Test Fixes and tag: filter.

* fixed test_ec2.test_amis.test_ami_filters to test for AMIs in the state of 'available'
  * enhanced AMI's to be able to take `tag:` filter.
  * added tag: tests for AMIs
This commit is contained in:
Joseph Lawson 2014-09-30 16:42:52 -04:00
commit 7fca88e732
2 changed files with 28 additions and 1 deletions

View file

@ -606,6 +606,10 @@ class Ami(TaggedEC2Instance):
return self.id
elif filter_name == 'state':
return self.state
elif filter_name.startswith('tag:'):
tag_name = filter_name.replace('tag:', '', 1)
tags = dict((tag['key'], tag['value']) for tag in self.get_tags())
return tags.get(tag_name)
else:
ec2_backend.raise_not_implemented_error("The filter '{0}' for DescribeImages".format(filter_name))