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.
This commit is contained in:
Tim Abbott 2021-12-06 14:08:17 -08:00
parent fee05339a2
commit 8aafce5619
1 changed files with 11 additions and 0 deletions

View File

@ -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()