Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

tests: Fix test_create_user_with_multiple_streams.

Steve Howell5ef01b3ad8af
diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py
index 321b4c195e8..5e830f8ee4e 100644
--- a/zerver/tests/test_users.py
+++ b/zerver/tests/test_users.py
@@ -7,6 +7,7 @@ import orjson
from django.conf import settings
from django.core.exceptions import ValidationError
from django.test import override_settings
+from django.utils.timezone import now as timezone_now
from zerver.lib.actions import (
create_users,
@@ -41,6 +42,7 @@ from zerver.lib.users import access_user_by_id, get_accounts_for_email, user_ids
from zerver.models import (
CustomProfileField,
InvalidFakeEmailDomain,
+ Message,
PreregistrationUser,
Realm,
RealmDomain,
@@ -720,6 +722,9 @@ class PermissionTest(ZulipTestCase):
class QueryCountTest(ZulipTestCase):
def test_create_user_with_multiple_streams(self) -> None:
+ # add_new_user_history needs messages to be current
+ Message.objects.all().update(date_sent=timezone_now())
+
# This just focuses on making sure we don't too many
# queries/cache tries or send too many events.
realm = get_realm("zulip")