zulip/zerver/tests
m-e-l-u-h-a-n 1b8a5a3344 markdown: Refactor backend logic for handling user mention.
Backend logic for handling user mention was cluttered
because it was handled at two stages first in
get_possible_mentions_info while fetching mention data
based on the messsage and then later in UserMentionPattern
which handles processing of text for mention.

Ideally UserMentionPattern should depend on
get_possible_mentions_info only for data but there was a
shared logic between these two that made it hard to debug
any possible bugs.

Updates in this commit make both of these functions
coherent in terms of logic and also add appropiate
comments to improve readability of these functions.

There was also a hidden bug that if a user A is
mentioned in with @**name|id** then @**invalid|id**
again mentioned A because of the way we handled mentions
earlier. It is solved as a result of this refactor and
appropiate test has been added for this.

This has been tested manually as well as by adding new
test to address missing case.
2021-03-28 16:52:48 -07:00
..
fixtures markdown: Add support to shorten GitHub links. 2021-03-25 00:39:44 -07:00
images emoji: Only resize custom emoji that need it. 2019-01-29 10:33:50 -08:00
__init__.py
test_alert_words.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_archive.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_attachments.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_audit_log.py actions: Include ROLE_MODERATOR in realm_user_count_by_role. 2021-02-23 15:01:14 -08:00
test_auth_backends.py ldap: Add option to limit user access to certain realms. 2021-03-18 11:19:59 -07:00
test_bots.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_cache.py tests: Eliminate use of get_user_profile_by_email in tests. 2021-03-11 20:30:57 -08:00
test_camo.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_compatibility.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_create_video_call.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_custom_profile_data.py custom profile fields: Rename s/choice/select/ in tests. 2021-03-24 12:57:55 -07:00
test_data_types.py data_types: Generalize StringDictType. 2020-09-25 11:43:19 -07:00
test_decorators.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_digest.py refactor: Make acting_user a mandatory kwarg for do_create_user. 2021-02-25 17:58:00 -08:00
test_docs.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_drafts.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
test_email_change.py email: Set an envelope-from which may be different from the From: field. 2021-02-24 17:32:28 -08:00
test_email_log.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_email_mirror.py email-integration: Notify user on failure to send message via email. 2021-03-17 14:56:17 -07:00
test_email_notifications.py email: Set an envelope-from which may be different from the From: field. 2021-02-24 17:32:28 -08:00
test_embedded_bot_system.py logging: use assertEqual to assert logging output. 2021-03-25 01:10:03 -07:00
test_event_queue.py refactor: Integrate POSTRequestMock into HostRequestMock. 2021-03-03 21:52:05 -08:00
test_event_system.py event_schema: Add checker for restart event. 2021-03-23 12:16:20 -07:00
test_events.py events: Fix broken custom_profile_fields events logic. 2021-03-26 16:28:33 -07:00
test_external.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_github.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_gitter_importer.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_home.py test_home: Fix missing do_change_plan_type import. 2021-03-23 16:12:04 -07:00
test_hotspots.py hotspots: Extract INTRO_HOTSPOTS from ALL_HOTSPOTS. 2021-02-26 15:02:48 -08:00
test_i18n.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_import_export.py logging: migrate test_import_export to use assertLogs. 2021-03-25 01:10:03 -07:00
test_integrations.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_integrations_dev_panel.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_internet.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_legacy_subject.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_link_embed.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_logging_handlers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_management_commands.py refactor: Make acting_user a mandatory kwarg for do_create_user. 2021-02-25 17:58:00 -08:00
test_markdown.py markdown: Refactor backend logic for handling user mention. 2021-03-28 16:52:48 -07:00
test_mattermost_importer.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_message_dict.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_message_edit.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_message_edit_notifications.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_message_fetch.py refactor: Integrate POSTRequestMock into HostRequestMock. 2021-03-03 21:52:05 -08:00
test_message_flags.py message: Record whether unread_msgs data is truncated. 2021-03-21 19:48:13 -07:00
test_message_send.py tests: Use do_create_realm where possible. 2021-03-14 08:50:02 -07:00
test_message_topics.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_messages.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_middleware.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_migrations.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_mirror_users.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_muting.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_new_users.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_onboarding.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_openapi.py api: Support user_id in get_user_presence_endpoint. 2021-03-11 20:14:04 -08:00
test_outgoing_webhook_interfaces.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_outgoing_webhook_system.py outgoing_webhook: modify outgoing_webhook's 407 error message. 2021-03-18 14:39:26 -07:00
test_populate_db.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
test_presence.py api: Support user_id in get_user_presence_endpoint. 2021-03-11 20:14:04 -08:00
test_push_notifications.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_queue.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_queue_worker.py invites: Delete old compat code in the invites queue worker. 2021-02-26 08:26:43 -08:00
test_rate_limiter.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_reactions.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_realm.py tests: Eliminate use of get_user_profile_by_email in tests. 2021-03-11 20:30:57 -08:00
test_realm_domains.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_realm_emoji.py refactor: Make acting_user a mandatory kwarg for do_create_user. 2021-02-25 17:58:00 -08:00
test_realm_export.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_realm_filters.py linkifiers: Remove outdated comment in tests. 2021-03-15 11:19:59 -07:00
test_redis_utils.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_report.py test_report: Avoid Any type. 2021-02-15 17:05:28 -08:00
test_retention.py tests: Use do_create_realm where possible. 2021-03-14 08:50:02 -07:00
test_service_bot_system.py refactor: Make acting_user a mandatory kwarg for do_create_user. 2021-02-25 17:58:00 -08:00
test_sessions.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_settings.py display_settings: Allow user to set default_view. 2021-03-11 18:09:08 -08:00
test_signup.py do_create_realm: Require passing kwargs by name. 2021-03-14 08:50:02 -07:00
test_slack_importer.py import/export: Fix black formatting. 2021-03-08 13:08:35 -08:00
test_slack_message_conversion.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_soft_deactivation.py users: Add new user 'shiva' as realm moderator. 2021-02-23 15:00:49 -08:00
test_subdomains.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_submessage.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_subs.py test_subs: Remove redundant cache_delete calls. 2021-03-25 00:47:42 -07:00
test_templates.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_thumbnail.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_timestamp.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_timezone.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
test_tornado.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_transfer.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_tutorial.py actions: Remove realm argument to internal_send_private_message. 2021-02-23 15:26:47 -08:00
test_type_debug.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_typing.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_upload.py tests: Use do_create_realm where possible. 2021-03-14 08:50:02 -07:00
test_urls.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_user_groups.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_user_status.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_users.py models: Make get_human_admin_users optionally not return realm owners. 2021-03-22 18:10:03 -07:00
test_webhooks_common.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_widgets.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_zcommand.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
test_zephyr.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00