Added support for filtering AMIs by self (#1398)
* Added support for filtering AMIs by self Closes: https://github.com/spulec/moto/issues/1396 * Adjusted regex to also match signature v4 and fixed py3 compatibility
This commit is contained in:
parent
71af9317f2
commit
56ce26a728
4 changed files with 44 additions and 6 deletions
|
|
@ -705,3 +705,17 @@ def test_ami_filter_by_owner_id():
|
|||
assert all(ubuntu_ids) and ubuntu_ids[0] == ubuntu_id
|
||||
# Check we actually have a subset of images
|
||||
assert len(ubuntu_ids) < len(all_ids)
|
||||
|
||||
@mock_ec2
|
||||
def test_ami_filter_by_self():
|
||||
client = boto3.client('ec2', region_name='us-east-1')
|
||||
|
||||
my_images = client.describe_images(Owners=['self'])
|
||||
assert len(my_images) == 0
|
||||
|
||||
# Create a new image
|
||||
instance = ec2.create_instances(ImageId='ami-1234abcd', MinCount=1, MaxCount=1)[0]
|
||||
image = instance.create_image(Name='test-image')
|
||||
|
||||
my_images = client.describe_images(Owners=['self'])
|
||||
assert len(my_images) == 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue