* (fix) Fixes #3648

* (fix) formatting

* (review) add assertion for exception thrown
This commit is contained in:
Brandon Clodius 2021-02-02 10:21:16 -05:00 committed by GitHub
parent 7d066cea2f
commit 81859f9180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -827,9 +827,10 @@ Member must satisfy regular expression pattern: {}".format(
for load_balancer in self.load_balancers.values():
for listener_arn in listener_arns:
listener = load_balancer.listeners.get(listener_arn)
if not listener:
raise ListenerNotFoundError()
matched.append(listener)
if listener:
matched.append(listener)
if listener_arns and len(matched) == 0:
raise ListenerNotFoundError()
return matched
def delete_load_balancer(self, arn):

View File

@ -415,10 +415,9 @@ def test_create_target_group_and_listeners():
response.get("LoadBalancers").should.have.length_of(0)
# And it deleted the remaining listener
response = conn.describe_listeners(
ListenerArns=[http_listener_arn, https_listener_arn]
)
response.get("Listeners").should.have.length_of(0)
with pytest.raises(ClientError) as e:
conn.describe_listeners(ListenerArns=[http_listener_arn, https_listener_arn])
e.value.response["Error"]["Code"].should.equal("ListenerNotFound")
# But not the target groups
response = conn.describe_target_groups()