test_event_queue: Introduce helper to fill-up default values.

This allows us to only mention the values that are relevant
to the behavior being tested by the `check_notify` function
in the current assertion.
This commit is contained in:
Abhijeet Prasad Bodas
2021-06-08 18:30:11 +05:30
committed by Tim Abbott
parent 8eec7b4718
commit d9395e7b52
2 changed files with 38 additions and 130 deletions

View File

@@ -1292,6 +1292,27 @@ Output:
self.assert_length(lst, expected_num_events)
def get_maybe_enqueue_notifications_parameters(self, **kwargs: Any) -> Dict[str, Any]:
"""
Returns a dictionary with the passed parameters, after filling up the
missing data with default values, for testing what was passed to the
`maybe_enqueue_notifications` method.
"""
parameters: Dict[str, Any] = dict(
private_message=False,
mentioned=False,
wildcard_mention_notify=False,
stream_push_notify=False,
stream_email_notify=False,
stream_name=None,
online_push_enabled=False,
idle=True,
already_notified={"email_notified": False, "push_notified": False},
)
# Values from `kwargs` will replace those from `parameters`
return {**parameters, **kwargs}
class WebhookTestCase(ZulipTestCase):
"""