From 8aafce5619e4af85dbf2f4a88e9efd47fb99f07b Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 6 Dec 2021 14:08:17 -0800 Subject: [PATCH] test_signup: Fix test failures with week old test database. The comment explains in more detail, but basically we'd skip exercising a bit of code in the signup code path if there were no messages in the last week, resulting in the query count not matching. --- zerver/tests/test_signup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index a977f718f7..9a813efe27 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -848,6 +848,17 @@ class LoginTest(ZulipTestCase): stream = self.make_stream(stream_name, realm=realm) DefaultStream.objects.create(stream=stream, realm=realm) + # Make sure there's at least one recent message to be mark + # unread. This prevents a bug where this test would start + # failing the test database was generated more than + # ONBOARDING_RECENT_TIMEDELTA ago. + self.send_stream_message( + self.example_user("hamlet"), + stream_names[0], + topic_name="test topic", + content="test message", + ) + # Clear all the caches. flush_per_request_caches() ContentType.objects.clear_cache()