mirror of https://github.com/zulip/zulip.git
populate_db: Set user_topic policies to NEVER only for test-database.
Earlier, the 'automatically_follow_topics_policy' and
'automatically_unmute_topics_in_muted_streams_policy' were set
to 'NEVER' for both the test and dev databases.
This commit fixes the incorrect behavior.
Now, we set it to 'NEVER' only for the test-database.
We need the actual default value in our dev database.
We explicitly set it to NEVER for test-database as it skews other
tests by generating extra events and db queries. We have separate
tests with different values to test the intended behavior related
to these settings.
The bug was introduced in 58568a6
.
This commit is contained in:
parent
db05d7ef0c
commit
5a95ae3650
|
@ -829,28 +829,29 @@ class Command(BaseCommand):
|
||||||
UserProfile.objects.filter(is_bot=False, realm=zulip_realm)
|
UserProfile.objects.filter(is_bot=False, realm=zulip_realm)
|
||||||
)
|
)
|
||||||
|
|
||||||
# As we plan to change the default values for 'automatically_follow_topics_policy' and
|
if options["test_suite"]:
|
||||||
# 'automatically_unmute_topics_in_muted_streams_policy' in the future, it will lead to
|
# As we plan to change the default values for 'automatically_follow_topics_policy' and
|
||||||
# skewing a lot of our tests, which now need to take into account extra events and database queries.
|
# 'automatically_unmute_topics_in_muted_streams_policy' in the future, it will lead to
|
||||||
#
|
# skewing a lot of our tests, which now need to take into account extra events and database queries.
|
||||||
# We explicitly set the values for both settings to 'AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER'
|
#
|
||||||
# to make the tests independent of the default values.
|
# We explicitly set the values for both settings to 'AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER'
|
||||||
#
|
# to make the tests independent of the default values.
|
||||||
# We have separate tests to verify events generated, database query counts,
|
#
|
||||||
# and other important details related to the above-mentioned settings.
|
# We have separate tests to verify events generated, database query counts,
|
||||||
for user in user_profiles:
|
# and other important details related to the above-mentioned settings.
|
||||||
do_change_user_setting(
|
for user in user_profiles:
|
||||||
user,
|
do_change_user_setting(
|
||||||
"automatically_follow_topics_policy",
|
user,
|
||||||
UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER,
|
"automatically_follow_topics_policy",
|
||||||
acting_user=None,
|
UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER,
|
||||||
)
|
acting_user=None,
|
||||||
do_change_user_setting(
|
)
|
||||||
user,
|
do_change_user_setting(
|
||||||
"automatically_unmute_topics_in_muted_streams_policy",
|
user,
|
||||||
UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER,
|
"automatically_unmute_topics_in_muted_streams_policy",
|
||||||
acting_user=None,
|
UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_NEVER,
|
||||||
)
|
acting_user=None,
|
||||||
|
)
|
||||||
|
|
||||||
# Create a test realm emoji.
|
# Create a test realm emoji.
|
||||||
IMAGE_FILE_PATH = static_path("images/test-images/checkbox.png")
|
IMAGE_FILE_PATH = static_path("images/test-images/checkbox.png")
|
||||||
|
|
Loading…
Reference in New Issue