fix bug that remove_rule doesnt remove rule correctly (#1074)
This commit is contained in:
parent
ce7eabd44a
commit
2ace59a60e
@ -116,6 +116,9 @@ class FakeListener(BaseModel):
|
||||
def rules(self):
|
||||
return self._non_default_rules + [self._default_rule]
|
||||
|
||||
def remove_rule(self, rule):
|
||||
self._non_default_rules.remove(rule)
|
||||
|
||||
def register(self, rule):
|
||||
self._non_default_rules.append(rule)
|
||||
self._non_default_rules = sorted(self._non_default_rules, key=lambda x: x.priority)
|
||||
@ -410,7 +413,7 @@ class ELBv2Backend(BaseBackend):
|
||||
for listener in listeners:
|
||||
for rule in listener.rules:
|
||||
if rule.arn == arn:
|
||||
listener.rules.remove(rule)
|
||||
listener.remove_rule(rule)
|
||||
return
|
||||
|
||||
# should raise RuleNotFound Error according to the AWS API doc
|
||||
|
@ -770,6 +770,8 @@ def test_handle_listener_rules():
|
||||
# delete
|
||||
arn = first_rule['RuleArn']
|
||||
conn.delete_rule(RuleArn=arn)
|
||||
rules = conn.describe_rules(ListenerArn=http_listener_arn)['Rules']
|
||||
len(rules).should.equal(2)
|
||||
|
||||
# test for invalid action type
|
||||
safe_priority = 2
|
||||
|
Loading…
Reference in New Issue
Block a user