mirror of https://github.com/zulip/zulip.git
typing: Add assertions for Optional values.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
7c62af0d73
commit
56855e0187
|
@ -3795,6 +3795,7 @@ def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:
|
|||
and user_profile.default_events_register_stream.invite_only
|
||||
)
|
||||
if is_private_bot:
|
||||
assert user_profile.bot_owner_id is not None
|
||||
return {user_profile.bot_owner_id}
|
||||
else:
|
||||
users = {user.id for user in user_profile.realm.get_human_admin_users()}
|
||||
|
|
|
@ -403,6 +403,7 @@ class PreviewTestCase(ZulipTestCase):
|
|||
|
||||
# Verify the initial message doesn't have the embedded links rendered
|
||||
msg = Message.objects.select_related("sender").get(id=msg_id)
|
||||
assert msg.rendered_content is not None
|
||||
self.assertNotIn(f'<a href="{url}" title="The Rock">The Rock</a>', msg.rendered_content)
|
||||
|
||||
self.create_mock_response(url, relative_url=relative_url)
|
||||
|
@ -449,6 +450,7 @@ class PreviewTestCase(ZulipTestCase):
|
|||
in info_logs.output[0]
|
||||
)
|
||||
msg = Message.objects.select_related("sender").get(id=msg_id)
|
||||
assert msg.rendered_content is not None
|
||||
# The content of the message has changed since the event for original_url has been created,
|
||||
# it should not be rendered. Another, up-to-date event will have been sent (edited_url).
|
||||
self.assertNotIn(
|
||||
|
|
Loading…
Reference in New Issue