diff --git a/tools/test-backend b/tools/test-backend index 8fabb694fe..0fcca806ba 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -78,7 +78,6 @@ not_yet_fully_covered = [ "zerver/actions/create_realm.py", "zerver/actions/message_edit.py", "zerver/actions/presence.py", - "zerver/actions/scheduled_messages.py", "zerver/lib/addressee.py", "zerver/lib/markdown/__init__.py", "zerver/lib/cache.py", diff --git a/zerver/tests/test_scheduled_messages.py b/zerver/tests/test_scheduled_messages.py index 9b31796956..0dc1b48dbe 100644 --- a/zerver/tests/test_scheduled_messages.py +++ b/zerver/tests/test_scheduled_messages.py @@ -190,6 +190,19 @@ class ScheduledMessageTest(ZulipTestCase): ) self.assertEqual(delivered_message.date_sent, more_than_scheduled_delivery_datetime) + # Check error is sent if an edit happens after the scheduled + # message is successfully sent. + new_delivery_datetime = timezone_now() + datetime.timedelta(minutes=7) + new_delivery_timestamp = int(new_delivery_datetime.timestamp()) + updated_response = self.do_schedule_message( + "direct", + [othello.id], + "New content!", + new_delivery_timestamp, + scheduled_message_id=str(scheduled_message.id), + ) + self.assert_json_error(updated_response, "Scheduled message was already sent") + def verify_deliver_scheduled_message_failure( self, scheduled_message: ScheduledMessage, logger: mock.Mock, expected_failure_message: str ) -> None: