user_topics: Update test to verify end-to-end behaviour.

This commit updates 'test_user_ids_unmuting_topic' to make
an api_post call to '/api/v1/user_topics' instead of
calling the internal function 'do_set_user_topic_visibility_policy'
to verify the logic.
This commit is contained in:
Prakhar Pratyush 2023-04-03 03:06:13 +05:30 committed by Tim Abbott
parent f012d079c3
commit ab7cd3c40a
1 changed files with 10 additions and 7 deletions

View File

@ -470,14 +470,17 @@ class UnmutedTopicsTests(ZulipTestCase):
)
self.assertEqual(user_ids, set())
url = "/api/v1/user_topics"
def set_topic_visibility_for_user(user: UserProfile, visibility_policy: int) -> None:
do_set_user_topic_visibility_policy(
user,
stream,
"test TOPIC",
visibility_policy=visibility_policy,
last_updated=date_unmuted,
)
data = {
"stream_id": stream.id,
"topic": "test TOPIC",
"visibility_policy": visibility_policy,
}
with time_machine.travel(datetime(2020, 1, 1, tzinfo=timezone.utc), tick=False):
result = self.api_post(user, url, data)
self.assert_json_success(result)
set_topic_visibility_for_user(hamlet, UserTopic.VisibilityPolicy.UNMUTED)
set_topic_visibility_for_user(cordelia, UserTopic.VisibilityPolicy.MUTED)