correctly filter describe_managed_prefix_lists, add test for the behavior (#4837)

This commit is contained in:
Daniel Fangl 2022-02-07 20:07:15 +01:00 committed by GitHub
parent 32373d2ac5
commit 87dfa2e922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -5566,8 +5566,8 @@ class ManagedPrefixListBackend(object):
result = managed_prefix_lists
if filters:
result = filter_resources(managed_prefix_lists, filters, attr_pairs)
result = describe_tag_filter(filters, managed_prefix_lists)
result = filter_resources(result, filters, attr_pairs)
result = describe_tag_filter(filters, result)
for item in result.copy():
if not item.delete_counter:

View File

@ -1097,3 +1097,16 @@ def test_describe_vpcs_dryrun():
ex.value.response["Error"]["Message"].should.equal(
"An error occurred (DryRunOperation) when calling the DescribeVpcs operation: Request would have succeeded, but DryRun flag is set"
)
@mock_ec2
def test_describe_prefix_lists():
client = boto3.client("ec2", region_name="us-east-1")
result_unfiltered = client.describe_prefix_lists()
assert len(result_unfiltered["PrefixLists"]) > 1
result_filtered = client.describe_prefix_lists(
Filters=[
{"Name": "prefix-list-name", "Values": ["com.amazonaws.us-east-1.s3"]},
]
)
assert len(result_filtered["PrefixLists"]) == 1