test_events: Fix loop structure in settings test.

The original commit was broken here:
b553507412

The intention was to run the same loop for all
settings, but instead, we did a funny loop of
just resetting schema_checker, and then we only
actually tested the last value of the loop.
This commit is contained in:
Steve Howell 2020-08-17 12:06:06 +00:00 committed by Steve Howell
parent 35dd6ef93b
commit 33d7a22685
1 changed files with 22 additions and 21 deletions

View File

@ -1148,29 +1148,30 @@ class NormalActionsTest(BaseAction):
('name', check_string),
('email', check_string),
])
stream = get_stream("Denmark", self.user_profile.realm)
sub = get_subscription(stream.name, self.user_profile)
# First test with notification_settings_null enabled
for value in (True, False):
events = self.verify_action(
lambda: do_change_subscription_property(
self.user_profile,
sub,
stream,
setting_name, value),
notification_settings_null=True)
schema_checker('events[0]', events[0])
stream = get_stream("Denmark", self.user_profile.realm)
sub = get_subscription(stream.name, self.user_profile)
for value in (True, False):
events = self.verify_action(
lambda: do_change_subscription_property(
self.user_profile,
sub,
stream,
setting_name,
value))
schema_checker('events[0]', events[0])
# First test with notification_settings_null enabled
for value in (True, False):
events = self.verify_action(
lambda: do_change_subscription_property(
self.user_profile,
sub,
stream,
setting_name, value),
notification_settings_null=True)
schema_checker('events[0]', events[0])
for value in (True, False):
events = self.verify_action(
lambda: do_change_subscription_property(
self.user_profile,
sub,
stream,
setting_name,
value))
schema_checker('events[0]', events[0])
def test_change_realm_message_edit_settings(self) -> None:
schema_checker = check_events_dict([