zulip/zerver/tests
Alex Vandiver 2e50ead9d1 data_import: Fix bot email address de-duplication.
4815f6e28b tried to de-duplicate bot
email addresses, but instead caused duplicates to crash:

```
Traceback (most recent call last):
  File "./manage.py", line 157, in <module>
    execute_from_command_line(sys.argv)
  File "./manage.py", line 122, in execute_from_command_line
    utility.execute()
  File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/management/commands/convert_slack_data.py", line 59, in handle
    do_convert_data(path, output_dir, token, threads=num_threads)
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 1320, in do_convert_data
    ) = slack_workspace_to_realm(
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 141, in slack_workspace_to_realm
    ) = users_to_zerver_userprofile(slack_data_dir, user_list, realm_id, int(NOW), domain_name)
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 248, in users_to_zerver_userprofile
    email = get_user_email(user, domain_name)
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 406, in get_user_email
    return SlackBotEmail.get_email(user["profile"], domain_name)
  File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 85, in get_email
    email_prefix += cls.duplicate_email_count[email]
TypeError: can only concatenate str (not "int") to str
```

Fix the stringification, make it case-insensitive, append with a dash
for readability, and add tests for all of the above.
2022-03-31 11:10:18 -07:00
..
fixtures docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
images emoji: Support animated PNGs. 2022-03-15 12:47:21 -07:00
__init__.py
test_alert_words.py tests: Fix unused `message_id` parameter in tests. 2022-02-21 08:52:33 -08:00
test_attachments.py migrations: Change realm field to be not null in Attachment. 2022-03-18 12:01:15 -07:00
test_audit_log.py types: Create a new TypedDict RealmPlaygroundDict for playground objects. 2022-03-15 15:58:36 -07:00
test_auth_backends.py tests: Avoid use of Python internal __unittest_skip__ flag. 2022-03-07 16:26:37 -08:00
test_bots.py bots: Don't allow admins to change owner of bot with can_create_users. 2022-03-20 17:18:21 -07:00
test_cache.py bots: Pass realm to get_system_bot calls in test_cache.py. 2021-07-26 15:33:13 -07:00
test_compatibility.py python: Reformat with Black 22 (stable). 2022-02-18 18:03:13 -08:00
test_create_video_call.py integrations: Fix BigBlueButton password length. 2022-03-20 16:09:36 -07:00
test_custom_profile_data.py validator: Replace converter=orjson.loads with json_validator. 2022-03-15 13:02:02 -07:00
test_data_types.py
test_decorators.py validator: Add WildValue class for enforcing JSON type checking. 2022-03-15 13:02:02 -07:00
test_digest.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_docs.py help_docs: Clarify relative link text for Subscribed streams tab. 2022-03-28 15:13:39 -07:00
test_drafts.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_email_change.py python: Reformat with Black 22 (stable). 2022-02-18 18:03:13 -08:00
test_email_log.py
test_email_mirror.py tests: Remove `client` parameter if test can use default `User-Agent`. 2022-02-24 12:57:18 -08:00
test_email_notifications.py tests: Remove `client` parameter if test can use default `User-Agent`. 2022-02-24 12:57:18 -08:00
test_embedded_bot_system.py tests: Ensure stream senders get a UserMessage row. 2021-12-10 09:40:04 -08:00
test_event_queue.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_event_system.py docs: Add missing space to compound verbs “back up”, “log in”, etc. 2022-02-07 19:20:54 -08:00
test_events.py events: Add functionality to mark messages as unread. 2022-03-15 18:00:35 -07:00
test_example.py populate_db: Add timezones for some test users. 2022-02-22 11:14:58 -08:00
test_external.py tests: Remove `client` parameter if test can use default `User-Agent`. 2022-02-24 12:57:18 -08:00
test_github.py downloads: Serve desktop downloads from desktop-download.zulip.com. 2021-08-28 23:08:45 -07:00
test_gitter_importer.py
test_home.py events: Remove some properties of user sent to spectators. 2022-02-22 10:36:08 -08:00
test_hotspots.py hotspots: Remove intro_reply hotspot. 2021-12-07 21:55:59 -08:00
test_i18n.py invite: Extend invite api for handling expiration duration. 2021-09-10 16:53:03 -07:00
test_import_export.py user_topic: Rename topic_mutes.py to user_topics.py. 2022-03-11 14:26:55 -08:00
test_integrations.py
test_integrations_dev_panel.py airbrake: Strengthen types using WildValue. 2022-03-15 13:02:02 -07:00
test_internet.py
test_legacy_subject.py tests: Remove `client` parameter if test can use default `User-Agent`. 2022-02-24 12:57:18 -08:00
test_link_embed.py tests: Fix unused `message_id` parameter in tests. 2022-02-21 08:52:33 -08:00
test_logging_handlers.py typing: Fix function signatures with django-stubs. 2021-08-20 06:02:55 -07:00
test_management_commands.py python: Reformat with Black 22 (stable). 2022-02-18 18:03:13 -08:00
test_markdown.py markdown: Allow whitespace overlaps in topic linkifiers. 2022-03-22 15:40:03 -07:00
test_mattermost_importer.py tests: Verify emoji codes. 2021-12-06 13:22:47 -08:00
test_message_dict.py tests: Ensure stream senders get a UserMessage row. 2021-12-10 09:40:04 -08:00
test_message_edit.py message_edit: Ignore duplicates when re-muting new topic name. 2022-03-24 21:27:11 -07:00
test_message_edit_notifications.py push_notifications: Ensure notifications are on for the remove codepath. 2022-03-09 16:33:51 -08:00
test_message_fetch.py user_topic: Rename topic_mutes.py to user_topics.py. 2022-03-11 14:26:55 -08:00
test_message_flags.py python: Use modern set comprehension syntax. 2022-03-25 10:45:12 -07:00
test_message_send.py realm: Create RealmAuditLog entry while adding a new allowed domain. 2022-03-10 17:48:02 -08:00
test_message_topics.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_messages.py notifications: Calculate PMs/mentions settings like other settings. 2021-07-28 13:55:25 -07:00
test_middleware.py help_docs: Update edit history documentation for messages. 2022-03-25 17:03:53 -07:00
test_migrations.py tests: Mark test_migrations tests to be automatically skipped. 2022-03-07 15:33:29 -08:00
test_mirror_users.py tests: Migrate mocked Request to HostMockRequest. 2021-07-14 12:01:07 -07:00
test_muting_topics.py user_topic: Rename topic_mutes.py to user_topics.py. 2022-03-11 14:26:55 -08:00
test_muting_users.py muting: Handle the case of a race muting the same user twice. 2022-03-24 21:27:11 -07:00
test_new_users.py test_new_users: Select test emails deterministically. 2022-02-11 18:09:43 -08:00
test_notification_data.py notifications: Don't enqueue notifications for bots. 2022-01-03 09:55:06 -08:00
test_onboarding.py
test_openapi.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_outgoing_http.py python: Replace requests.packages.urllib3 alias with urllib3. 2022-01-23 22:14:17 -08:00
test_outgoing_webhook_interfaces.py outgoing webhooks: Fix inconsistencies with Slack's API. 2021-09-23 11:19:20 -07:00
test_outgoing_webhook_system.py
test_populate_db.py docs: Add missing space in “time zone”. 2022-02-24 14:05:12 -08:00
test_presence.py statistics: Remove unused seconds_usage_between function. 2021-08-19 01:51:37 -07:00
test_push_notifications.py push_notifications: Increase severity of APNs ConnectionError. 2022-03-25 18:12:14 -07:00
test_queue.py test_queue_error_json: Acknowledge the received message. 2022-01-21 13:38:13 -08:00
test_queue_worker.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_rate_limiter.py tests: Avoid use of Python internal __unittest_skip__ flag. 2022-03-07 16:26:37 -08:00
test_reactions.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_realm.py user_groups: Update user groups on changing waiting_period_threshold. 2022-03-14 18:53:47 -07:00
test_realm_domains.py realm: Create RealmAuditLog entry while changing an allowed domain. 2022-03-10 17:48:02 -08:00
test_realm_emoji.py realm_emoji: Stop swallowing all exceptions from upload_emoji_image. 2022-02-17 12:19:47 -08:00
test_realm_export.py test_classes: Extract assert_streaming_content helper. 2022-01-21 13:37:26 -08:00
test_realm_linkifiers.py linkifiers: Support URL percent-encoded bytes. 2021-10-22 13:00:20 -07:00
test_realm_playgrounds.py realm: Create RealmAuditLog entry when adding realm playgrounds. 2022-03-15 15:58:36 -07:00
test_redis_utils.py
test_report.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_retention.py migrations: Adjust related_name settings for ArchivedAttachment. 2022-03-24 19:15:27 -07:00
test_rocketchat_importer.py tests: Verify emoji codes. 2021-12-06 13:22:47 -08:00
test_scim.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_send_email.py send_email: Log error if EMAIL_HOST_USER is set without password. 2022-02-09 11:04:40 -08:00
test_service_bot_system.py
test_sessions.py auth: Add login buttons for web public access. 2021-10-05 16:30:40 -07:00
test_settings.py CVE-2021-3967: Only regenerate the API key by authing with the old key. 2022-02-25 14:00:52 -08:00
test_signup.py user_groups: Add members to the System groups created. 2022-03-14 18:53:46 -07:00
test_slack_importer.py data_import: Fix bot email address de-duplication. 2022-03-31 11:10:18 -07:00
test_slack_message_conversion.py
test_soft_deactivation.py
test_subdomains.py
test_submessage.py tests: Ensure stream senders get a UserMessage row. 2021-12-10 09:40:04 -08:00
test_subs.py tests: Remove ignored `stream_name` parameter from test. 2022-03-30 11:30:31 -07:00
test_templates.py markdown/tabbed_sections: Raise exception for missing tab name. 2021-10-01 16:25:17 -07:00
test_thumbnail.py upload: Allow rate limited access to spectators for uploaded files. 2022-03-24 10:50:00 -07:00
test_timestamp.py docs: Add missing space in “time zone”. 2022-02-24 14:05:12 -08:00
test_timezone.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_tornado.py
test_transfer.py tests: Use read_test_image_file. 2022-01-13 14:59:46 -08:00
test_tutorial.py onboarding: Manage occurrence of 'help' command. 2021-12-06 11:32:00 -08:00
test_type_debug.py
test_typing.py typing_notifications: Make privacy settings functional. 2021-10-07 17:39:22 -07:00
test_upload.py upload: Allow rate limited access to spectators for uploaded files. 2022-03-24 10:50:00 -07:00
test_urls.py test_urls: Fix get_callback_string logic. 2021-12-28 09:31:55 -08:00
test_user_groups.py user_groups: Add cron job for adding users to full members system group. 2022-03-14 18:53:47 -07:00
test_user_status.py user_status: Add backend changes to support status emoji. 2021-07-27 17:57:15 -07:00
test_users.py CVE-2022-24751: Clear sessions outside of the transaction. 2022-03-15 13:52:15 -07:00
test_webhooks_common.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
test_widgets.py tests: Remove `client` parameter if test can use default `User-Agent`. 2022-02-24 12:57:18 -08:00
test_zcommand.py zcommand: Replace "mode" with "theme" in the returned message. 2021-11-22 14:59:16 -08:00
test_zephyr.py