event_schema: Extract check_stream_delete.

This commit is contained in:
Steve Howell 2020-08-01 12:42:06 +00:00 committed by Tim Abbott
parent 059e0bb81e
commit 15ffd2b666
2 changed files with 10 additions and 7 deletions

View File

@ -506,6 +506,14 @@ check_stream_create = check_events_dict(
]
)
check_stream_delete = check_events_dict(
required_keys=[
("type", equals("stream")),
("op", equals("delete")),
("streams", check_list(check_dict_only(basic_stream_fields))),
]
)
_check_stream_update = check_events_dict(
required_keys=[
("type", equals("stream")),

View File

@ -91,7 +91,6 @@ from zerver.lib.actions import (
)
from zerver.lib.event_schema import (
avatar_fields,
basic_stream_fields,
check_alert_words,
check_custom_profile_fields,
check_default_stream_groups,
@ -107,6 +106,7 @@ from zerver.lib.event_schema import (
check_realm_update,
check_realm_user_update,
check_stream_create,
check_stream_delete,
check_stream_update,
check_submessage,
check_subscription_add,
@ -1649,12 +1649,7 @@ class NormalActionsTest(BaseAction):
action = lambda: do_deactivate_stream(stream)
events = self.verify_action(action)
schema_checker = check_events_dict([
('type', equals('stream')),
('op', equals('delete')),
('streams', check_list(check_dict_only(basic_stream_fields))),
])
schema_checker('events[0]', events[0])
check_stream_delete('events[0]', events[0])
def test_subscribe_other_user_never_subscribed(self) -> None:
action = lambda: self.subscribe(self.example_user("othello"), "test_stream")