adding owner id to amis v2 (#1331)
* Adding owner-id/OwnerId to the AMI classes to allow the value to be specified to test filtering images based on owner. * Added default AMIs and filtering by owner-id * Fixed some tests * Fixed more random tests * Updated MANIFEST * .
This commit is contained in:
parent
123f369e6e
commit
bd8c1e4567
14 changed files with 758 additions and 110 deletions
|
|
@ -666,10 +666,6 @@ def test_ami_attribute_error_cases():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
"""
|
||||
Boto3
|
||||
"""
|
||||
|
||||
@mock_ec2
|
||||
def test_ami_filter_wildcard():
|
||||
ec2 = boto3.resource('ec2', region_name='us-west-1')
|
||||
|
|
@ -678,3 +674,20 @@ def test_ami_filter_wildcard():
|
|||
filter_result = list(ec2.images.filter(Owners=['111122223333'], Filters=[{'Name':'name', 'Values':['test*']}]))
|
||||
assert filter_result == [image]
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_ami_filter_by_owner_id():
|
||||
client = boto3.client('ec2', region_name='us-east-1')
|
||||
|
||||
ubuntu_id = '099720109477'
|
||||
|
||||
ubuntu_images = client.describe_images(Owners=[ubuntu_id])
|
||||
all_images = client.describe_images()
|
||||
|
||||
ubuntu_ids = [ami['OwnerId'] for ami in ubuntu_images['Images']]
|
||||
all_ids = [ami['OwnerId'] for ami in all_images['Images']]
|
||||
|
||||
# Assert all ubuntu_ids are the same and one equals ubuntu_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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue