correctly filter describe_managed_prefix_lists, add test for the behavior (#4837)
This commit is contained in:
parent
32373d2ac5
commit
87dfa2e922
@ -5566,8 +5566,8 @@ class ManagedPrefixListBackend(object):
|
|||||||
|
|
||||||
result = managed_prefix_lists
|
result = managed_prefix_lists
|
||||||
if filters:
|
if filters:
|
||||||
result = filter_resources(managed_prefix_lists, filters, attr_pairs)
|
result = filter_resources(result, filters, attr_pairs)
|
||||||
result = describe_tag_filter(filters, managed_prefix_lists)
|
result = describe_tag_filter(filters, result)
|
||||||
|
|
||||||
for item in result.copy():
|
for item in result.copy():
|
||||||
if not item.delete_counter:
|
if not item.delete_counter:
|
||||||
|
@ -1097,3 +1097,16 @@ def test_describe_vpcs_dryrun():
|
|||||||
ex.value.response["Error"]["Message"].should.equal(
|
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"
|
"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
|
||||||
|
Loading…
Reference in New Issue
Block a user