Enhancement/describe network acls (#3003)

* update describe_network_acls and create unit test

* add fail test case

* adjustment after feedback

* fix result test
This commit is contained in:
André Nardy 2020-05-26 07:04:59 -03:00 committed by GitHub
commit 97a6e8d9e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 19 deletions

View file

@ -275,3 +275,32 @@ def test_duplicate_network_acl_entry():
rule_number
)
)
@mock_ec2
def test_describe_network_acls():
conn = boto3.client("ec2", region_name="us-west-2")
vpc = conn.create_vpc(CidrBlock="10.0.0.0/16")
vpc_id = vpc["Vpc"]["VpcId"]
network_acl = conn.create_network_acl(VpcId=vpc_id)
network_acl_id = network_acl["NetworkAcl"]["NetworkAclId"]
resp = conn.describe_network_acls(NetworkAclIds=[network_acl_id])
result = resp["NetworkAcls"]
result.should.have.length_of(1)
result[0]["NetworkAclId"].should.equal(network_acl_id)
resp2 = conn.describe_network_acls()["NetworkAcls"]
resp2.should.have.length_of(3)
with assert_raises(ClientError) as ex:
conn.describe_network_acls(NetworkAclIds=["1"])
str(ex.exception).should.equal(
"An error occurred (InvalidRouteTableID.NotFound) when calling the "
"DescribeNetworkAcls operation: The routeTable ID '1' does not exist"
)