test-events: Test do_delete_message with no messages specified.

Test coverage for `zerver/actions/message_delete.py`.

Both callers of this function would already return if there were
no Messages specified to delete, which is why existing tests did
not cover this.
This commit is contained in:
Lauryn Menard 2023-05-09 17:48:52 +02:00 committed by Tim Abbott
parent 7ccfed65e8
commit df17a1bf28
2 changed files with 8 additions and 1 deletions

View File

@ -76,7 +76,6 @@ not_yet_fully_covered = [
"analytics/views/support.py",
# Major lib files should have 100% coverage
"zerver/actions/create_realm.py",
"zerver/actions/message_delete.py",
"zerver/actions/message_edit.py",
"zerver/actions/presence.py",
"zerver/actions/scheduled_messages.py",

View File

@ -2512,6 +2512,14 @@ class NormalActionsTest(BaseAction):
result = fetch_initial_state_data(user_profile)
self.assertEqual(result["max_message_id"], -1)
def test_do_delete_message_with_no_messages(self) -> None:
events = self.verify_action(
lambda: do_delete_messages(self.user_profile.realm, []),
num_events=0,
state_change_expected=False,
)
self.assertEqual(events, [])
def test_add_attachment(self) -> None:
self.login("hamlet")
fp = StringIO("zulip!")