mirror of https://github.com/zulip/zulip.git
zerver/tests: Remove unused imports.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
f0ecb93515
commit
3127fb4dbd
|
@ -17,7 +17,6 @@ from zerver.lib.test_classes import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
Recipient,
|
|
||||||
UserProfile,
|
UserProfile,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
from zerver.lib.actions import do_create_user, do_deactivate_user, \
|
from zerver.lib.actions import do_create_user, do_deactivate_user, \
|
||||||
do_activate_user, do_reactivate_user, do_change_password, \
|
do_activate_user, do_reactivate_user, do_change_password, \
|
||||||
do_change_user_delivery_email, do_change_avatar_fields, do_change_bot_owner, \
|
do_change_user_delivery_email, do_change_avatar_fields, do_change_bot_owner, \
|
||||||
do_regenerate_api_key, do_change_full_name, do_change_tos_version, \
|
do_regenerate_api_key, do_change_tos_version, \
|
||||||
bulk_add_subscriptions, bulk_remove_subscriptions, get_streams_traffic
|
bulk_add_subscriptions, bulk_remove_subscriptions, get_streams_traffic
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import RealmAuditLog, get_client, get_realm
|
from zerver.models import RealmAuditLog, get_client, get_realm
|
||||||
|
|
|
@ -4,17 +4,14 @@ from django.core import mail
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django_auth_ldap.backend import _LDAPUser
|
from django_auth_ldap.backend import _LDAPUser
|
||||||
from django.contrib.auth import authenticate
|
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
||||||
from builtins import object
|
|
||||||
from oauth2client.crypt import AppIdentityError
|
from oauth2client.crypt import AppIdentityError
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
import httpretty
|
import httpretty
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
import jwt
|
import jwt
|
||||||
import mock
|
import mock
|
||||||
|
@ -22,7 +19,6 @@ import re
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from zerver.forms import HomepageForm
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
do_deactivate_realm,
|
do_deactivate_realm,
|
||||||
do_deactivate_user,
|
do_deactivate_user,
|
||||||
|
@ -44,13 +40,12 @@ from zerver.lib.sessions import get_session_dict_user
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_helpers import POSTRequestMock, HostRequestMock
|
|
||||||
from zerver.models import \
|
from zerver.models import \
|
||||||
get_realm, email_to_username, UserProfile, \
|
get_realm, email_to_username, UserProfile, \
|
||||||
PreregistrationUser, Realm, get_user, MultiuseInvite
|
PreregistrationUser, Realm, get_user, MultiuseInvite
|
||||||
from zerver.signals import JUST_CREATED_THRESHOLD
|
from zerver.signals import JUST_CREATED_THRESHOLD
|
||||||
|
|
||||||
from confirmation.models import Confirmation, confirmation_url, create_confirmation_link
|
from confirmation.models import Confirmation, create_confirmation_link
|
||||||
|
|
||||||
from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
|
from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
|
||||||
GoogleMobileOauth2Backend, ZulipRemoteUserBackend, ZulipLDAPAuthBackend, \
|
GoogleMobileOauth2Backend, ZulipRemoteUserBackend, ZulipLDAPAuthBackend, \
|
||||||
|
@ -61,19 +56,15 @@ from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
|
||||||
ZulipLDAPException, sync_user_from_ldap
|
ZulipLDAPException, sync_user_from_ldap
|
||||||
|
|
||||||
from zerver.views.auth import (maybe_send_to_registration,
|
from zerver.views.auth import (maybe_send_to_registration,
|
||||||
login_or_register_remote_user,
|
|
||||||
_subdomain_token_salt)
|
_subdomain_token_salt)
|
||||||
from version import ZULIP_VERSION
|
from version import ZULIP_VERSION
|
||||||
|
|
||||||
from social_core.exceptions import AuthFailed, AuthStateForbidden
|
from social_core.exceptions import AuthFailed, AuthStateForbidden
|
||||||
from social_django.strategy import DjangoStrategy
|
from social_django.strategy import DjangoStrategy
|
||||||
from social_django.storage import BaseDjangoStorage
|
from social_django.storage import BaseDjangoStorage
|
||||||
from social_core.backends.github import GithubOrganizationOAuth2, GithubTeamOAuth2, \
|
|
||||||
GithubOAuth2
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
from http.cookies import SimpleCookie
|
|
||||||
import ujson
|
import ujson
|
||||||
from zerver.lib.test_helpers import MockLDAP, load_subdomain_token
|
from zerver.lib.test_helpers import MockLDAP, load_subdomain_token
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import os
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from mock import patch, MagicMock
|
from mock import patch, MagicMock
|
||||||
from typing import Any, Dict, List, Mapping
|
from typing import Any, Dict, List, Mapping
|
||||||
|
@ -12,7 +11,7 @@ from typing import Any, Dict, List, Mapping
|
||||||
from zerver.lib.actions import do_change_stream_invite_only, do_deactivate_user
|
from zerver.lib.actions import do_change_stream_invite_only, do_deactivate_user
|
||||||
from zerver.lib.bot_config import get_bot_config
|
from zerver.lib.bot_config import get_bot_config
|
||||||
from zerver.models import get_realm, get_stream, \
|
from zerver.models import get_realm, get_stream, \
|
||||||
Realm, Stream, UserProfile, get_user, get_bot_services, Service, \
|
Realm, UserProfile, get_user, get_bot_services, Service, \
|
||||||
is_cross_realm_bot_email
|
is_cross_realm_bot_email
|
||||||
from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
|
|
|
@ -7,10 +7,8 @@ from zerver.lib.actions import (
|
||||||
do_set_user_display_setting,
|
do_set_user_display_setting,
|
||||||
do_remove_realm_emoji,
|
do_remove_realm_emoji,
|
||||||
do_set_alert_words,
|
do_set_alert_words,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
from zerver.lib.alert_words import alert_words_in_realm
|
from zerver.lib.alert_words import alert_words_in_realm
|
||||||
from zerver.lib.camo import get_camo_url
|
|
||||||
from zerver.lib.create_user import create_user
|
from zerver.lib.create_user import create_user
|
||||||
from zerver.lib.emoji import get_emoji_url
|
from zerver.lib.emoji import get_emoji_url
|
||||||
from zerver.lib.exceptions import BugdownRenderingException
|
from zerver.lib.exceptions import BugdownRenderingException
|
||||||
|
@ -40,7 +38,6 @@ from zerver.models import (
|
||||||
Realm,
|
Realm,
|
||||||
RealmEmoji,
|
RealmEmoji,
|
||||||
RealmFilter,
|
RealmFilter,
|
||||||
Recipient,
|
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
)
|
)
|
||||||
|
@ -50,8 +47,7 @@ import mock
|
||||||
import os
|
import os
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
import urllib
|
from typing import cast, Any, Dict, List, Optional, Set, Tuple
|
||||||
from typing import cast, Any, AnyStr, Dict, List, Optional, Set, Tuple
|
|
||||||
|
|
||||||
class FakeMessage:
|
class FakeMessage:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Union, List, Dict, Any
|
from typing import Union, List, Dict, Any
|
||||||
from mock import patch
|
|
||||||
|
|
||||||
from zerver.lib.actions import get_realm, try_add_realm_custom_profile_field, \
|
from zerver.lib.actions import get_realm, try_add_realm_custom_profile_field, \
|
||||||
do_update_user_custom_profile_data, do_remove_realm_custom_profile_field, \
|
do_update_user_custom_profile_data, do_remove_realm_custom_profile_field, \
|
||||||
|
|
|
@ -6,11 +6,9 @@ import os
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
||||||
from django_otp.conf import settings as otp_settings
|
|
||||||
|
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpResponse, HttpRequest
|
||||||
from django.test.client import RequestFactory
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from zerver.forms import OurAuthenticationForm
|
from zerver.forms import OurAuthenticationForm
|
||||||
|
@ -23,7 +21,6 @@ from zerver.lib.test_helpers import (
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
WebhookTestCase,
|
|
||||||
)
|
)
|
||||||
from zerver.lib.response import json_response, json_success
|
from zerver.lib.response import json_response, json_success
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
|
@ -39,7 +36,7 @@ from zerver.decorator import (
|
||||||
authenticated_uploads_api_view,
|
authenticated_uploads_api_view,
|
||||||
authenticate_notify, cachify,
|
authenticate_notify, cachify,
|
||||||
get_client_name, internal_notify_view, is_local_addr,
|
get_client_name, internal_notify_view, is_local_addr,
|
||||||
rate_limit, validate_api_key, logged_in_and_active,
|
rate_limit, validate_api_key,
|
||||||
return_success_on_head_request, to_not_negative_int_or_none,
|
return_success_on_head_request, to_not_negative_int_or_none,
|
||||||
zulip_login_required
|
zulip_login_required
|
||||||
)
|
)
|
||||||
|
@ -50,7 +47,7 @@ from zerver.lib.validator import (
|
||||||
check_string_fixed_length, check_capped_string, check_color
|
check_string_fixed_length, check_capped_string, check_color
|
||||||
)
|
)
|
||||||
from zerver.models import \
|
from zerver.models import \
|
||||||
get_realm, get_user, UserProfile, Client, Realm, Recipient
|
get_realm, get_user, UserProfile, Realm
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import ujson
|
import ujson
|
||||||
|
@ -19,7 +18,6 @@ from zerver.lib.utils import split_by
|
||||||
from zerver.models import Realm, get_realm
|
from zerver.models import Realm, get_realm
|
||||||
from zerver.views.integrations import (
|
from zerver.views.integrations import (
|
||||||
add_api_uri_context,
|
add_api_uri_context,
|
||||||
add_integrations_context,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class DocPageTest(ZulipTestCase):
|
class DocPageTest(ZulipTestCase):
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Any
|
from email.utils import parseaddr
|
||||||
from email.utils import parseaddr, formataddr
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import django
|
|
||||||
import mock
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
from confirmation.models import Confirmation, generate_key, confirmation_url
|
from confirmation.models import Confirmation, generate_key, confirmation_url
|
||||||
|
@ -18,9 +12,7 @@ from zerver.lib.actions import do_start_email_change_process, do_set_realm_prope
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.models import get_user_by_delivery_email, EmailChangeStatus, get_realm
|
||||||
from zerver.models import get_user_by_delivery_email, EmailChangeStatus, Realm, get_realm, \
|
|
||||||
get_user_profile_by_id, get_user, UserProfile
|
|
||||||
|
|
||||||
|
|
||||||
class EmailChangeTestCase(ZulipTestCase):
|
class EmailChangeTestCase(ZulipTestCase):
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.http import HttpResponse
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
most_recent_message,
|
most_recent_message,
|
||||||
most_recent_usermessage,
|
most_recent_usermessage,
|
||||||
POSTRequestMock)
|
)
|
||||||
|
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
|
@ -32,21 +32,14 @@ from zerver.lib.email_mirror import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
from zerver.lib.notifications import (
|
|
||||||
handle_missedmessage_emails,
|
|
||||||
)
|
|
||||||
from zerver.management.commands import email_mirror
|
|
||||||
|
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.mime.image import MIMEImage
|
from email.mime.image import MIMEImage
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
|
||||||
import re
|
|
||||||
import ujson
|
import ujson
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from io import StringIO
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from typing import Any, Callable, Dict, Mapping, Union, Optional
|
from typing import Any, Callable, Dict, Mapping, Union, Optional
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
from typing import Any, Dict, Tuple, Optional
|
|
||||||
|
|
||||||
from zerver.lib.bot_lib import EmbeddedBotQuitException, EmbeddedBotHandler
|
from zerver.lib.bot_lib import EmbeddedBotQuitException
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
UserProfile, Recipient, get_display_recipient,
|
UserProfile, get_display_recipient,
|
||||||
get_service_profile, get_user, get_realm
|
get_service_profile, get_user, get_realm
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import POSTRequestMock
|
from zerver.lib.test_helpers import POSTRequestMock
|
||||||
from zerver.models import Recipient, Stream, Subscription, UserProfile, get_stream
|
from zerver.models import Recipient, Stream, Subscription, UserProfile, get_stream
|
||||||
from zerver.tornado.event_queue import maybe_enqueue_notifications, \
|
from zerver.tornado.event_queue import maybe_enqueue_notifications, \
|
||||||
allocate_client_descriptor, process_message_event, \
|
allocate_client_descriptor, \
|
||||||
get_client_descriptor, missedmessage_hook, persistent_queue_filename
|
get_client_descriptor, missedmessage_hook, persistent_queue_filename
|
||||||
from zerver.tornado.views import get_events
|
from zerver.tornado.views import get_events
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
|
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
|
||||||
# high-level documentation on how this system works.
|
# high-level documentation on how this system works.
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
@ -13,10 +13,10 @@ from django.utils.timezone import now as timezone_now
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_client, get_realm, get_stream_recipient, get_stream, get_user,
|
get_client, get_realm, get_stream_recipient, get_stream,
|
||||||
Message, RealmDomain, Recipient, UserMessage, UserPresence, UserProfile,
|
Message, RealmDomain, Recipient, UserMessage, UserPresence, UserProfile,
|
||||||
Realm, Subscription, Stream, flush_per_request_caches, UserGroup, Service,
|
Realm, Subscription, Stream, flush_per_request_caches, UserGroup, Service,
|
||||||
Attachment, PreregistrationUser, UserStatus,
|
Attachment, PreregistrationUser,
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
@ -87,7 +87,6 @@ from zerver.lib.actions import (
|
||||||
get_typing_user_profiles,
|
get_typing_user_profiles,
|
||||||
log_event,
|
log_event,
|
||||||
lookup_default_stream_groups,
|
lookup_default_stream_groups,
|
||||||
notify_attachment_update,
|
|
||||||
notify_realm_custom_profile_fields,
|
notify_realm_custom_profile_fields,
|
||||||
check_add_user_group,
|
check_add_user_group,
|
||||||
do_update_user_group_name,
|
do_update_user_group_name,
|
||||||
|
@ -125,7 +124,6 @@ from zerver.lib.validator import (
|
||||||
check_bool, check_dict, check_dict_only, check_float, check_int, check_list, check_string,
|
check_bool, check_dict, check_dict_only, check_float, check_int, check_list, check_string,
|
||||||
equals, check_none_or, Validator, check_url
|
equals, check_none_or, Validator, check_url
|
||||||
)
|
)
|
||||||
from zerver.lib.upload import upload_backend, attachment_url_to_path_id
|
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
|
|
||||||
from zerver.views.events_register import _default_all_public_streams, _default_narrow
|
from zerver.views.events_register import _default_all_public_streams, _default_narrow
|
||||||
|
@ -139,7 +137,6 @@ from zerver.tornado.event_queue import (
|
||||||
)
|
)
|
||||||
from zerver.tornado.views import get_events
|
from zerver.tornado.views import get_events
|
||||||
|
|
||||||
from collections import OrderedDict
|
|
||||||
import mock
|
import mock
|
||||||
import time
|
import time
|
||||||
import ujson
|
import ujson
|
||||||
|
|
|
@ -21,8 +21,6 @@ import DNS
|
||||||
import mock
|
import mock
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import urllib
|
|
||||||
|
|
||||||
class MITNameTest(ZulipTestCase):
|
class MITNameTest(ZulipTestCase):
|
||||||
def test_valid_hesiod(self) -> None:
|
def test_valid_hesiod(self) -> None:
|
||||||
with mock.patch('DNS.dnslookup', return_value=[['starnine:*:84233:101:Athena Consulting Exchange User,,,:/mit/starnine:/bin/bash']]):
|
with mock.patch('DNS.dnslookup', return_value=[['starnine:*:84233:101:Athena Consulting Exchange User,,,:/mit/starnine:/bin/bash']]):
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.timezone import now as timezone_now
|
|
||||||
|
|
||||||
from zerver.lib.import_realm import (
|
from zerver.lib.import_realm import (
|
||||||
do_import_realm,
|
do_import_realm,
|
||||||
)
|
)
|
||||||
|
@ -11,11 +8,7 @@ from zerver.lib.test_classes import (
|
||||||
from zerver.tests.test_import_export import (
|
from zerver.tests.test_import_export import (
|
||||||
rm_tree,
|
rm_tree,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_helpers import (
|
|
||||||
get_test_image_file,
|
|
||||||
)
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
Realm,
|
|
||||||
get_realm,
|
get_realm,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
Message,
|
Message,
|
||||||
|
@ -26,12 +19,10 @@ from zerver.data_import.gitter import (
|
||||||
)
|
)
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
|
||||||
import os
|
import os
|
||||||
import mock
|
import mock
|
||||||
from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple
|
from typing import Any, Dict, List, Set
|
||||||
|
|
||||||
class GitterImporter(ZulipTestCase):
|
class GitterImporter(ZulipTestCase):
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import override_settings
|
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from mock import MagicMock, patch
|
from mock import MagicMock, patch
|
||||||
import urllib
|
import urllib
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict
|
||||||
|
|
||||||
from zerver.lib.actions import do_create_user
|
from zerver.lib.actions import do_create_user
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
@ -20,7 +17,7 @@ from zerver.lib.test_helpers import (
|
||||||
from zerver.lib.soft_deactivation import do_soft_deactivate_users
|
from zerver.lib.soft_deactivation import do_soft_deactivate_users
|
||||||
from zerver.lib.test_runner import slow
|
from zerver.lib.test_runner import slow
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_realm, get_stream, get_user, UserProfile, UserMessage, Recipient,
|
get_realm, get_stream, get_user, UserProfile,
|
||||||
flush_per_request_caches, DefaultStream, Realm,
|
flush_per_request_caches, DefaultStream, Realm,
|
||||||
)
|
)
|
||||||
from zerver.views.home import home, sent_time_in_epoch_seconds
|
from zerver.views.home import home, sent_time_in_epoch_seconds
|
||||||
|
|
|
@ -4,12 +4,8 @@ from zerver.lib.actions import do_mark_hotspot_as_read, do_create_user
|
||||||
from zerver.lib.hotspots import ALL_HOTSPOTS, get_next_hotspots
|
from zerver.lib.hotspots import ALL_HOTSPOTS, get_next_hotspots
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import UserProfile, UserHotspot, get_realm
|
from zerver.models import UserProfile, UserHotspot, get_realm
|
||||||
from zerver.views.hotspots import mark_hotspot_as_read
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from typing import Any, Dict
|
|
||||||
import ujson
|
import ujson
|
||||||
import mock
|
|
||||||
|
|
||||||
# Splitting this out, since I imagine this will eventually have most of the
|
# Splitting this out, since I imagine this will eventually have most of the
|
||||||
# complicated hotspots logic.
|
# complicated hotspots logic.
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import django
|
|
||||||
import mock
|
import mock
|
||||||
import ujson
|
import ujson
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
@ -19,8 +18,6 @@ from zerver.lib.test_classes import (
|
||||||
from zerver.management.commands import makemessages
|
from zerver.management.commands import makemessages
|
||||||
from zerver.lib.notifications import enqueue_welcome_emails
|
from zerver.lib.notifications import enqueue_welcome_emails
|
||||||
|
|
||||||
from django.utils.timezone import now as timezone_now
|
|
||||||
|
|
||||||
class EmailTranslationTestCase(ZulipTestCase):
|
class EmailTranslationTestCase(ZulipTestCase):
|
||||||
def test_email_translation(self) -> None:
|
def test_email_translation(self) -> None:
|
||||||
def check_translation(phrase: str, request_type: str, *args: Any, **kwargs: Any) -> None:
|
def check_translation(phrase: str, request_type: str, *args: Any, **kwargs: Any) -> None:
|
||||||
|
|
|
@ -5,16 +5,13 @@ from django.conf import settings
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import ujson
|
import ujson
|
||||||
import io
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
from mock import patch, MagicMock
|
from mock import patch
|
||||||
from typing import Any, Dict, List, Set, Optional, Tuple, Callable, \
|
from typing import Any, Dict, List, Set, Optional, Tuple, Callable, \
|
||||||
FrozenSet
|
FrozenSet
|
||||||
|
|
||||||
from zerver.lib.export import (
|
from zerver.lib.export import (
|
||||||
do_export_realm,
|
do_export_realm,
|
||||||
export_files_from_s3,
|
|
||||||
export_usermessages_batch,
|
export_usermessages_batch,
|
||||||
do_export_user,
|
do_export_user,
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any
|
||||||
from requests.exceptions import ConnectionError
|
from requests.exceptions import ConnectionError
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
|
||||||
from zerver.models import Recipient, Message
|
from zerver.models import Message
|
||||||
from zerver.lib.actions import queue_json_publish
|
from zerver.lib.actions import queue_json_publish
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import MockPythonResponse
|
from zerver.lib.test_helpers import MockPythonResponse
|
||||||
|
|
|
@ -5,21 +5,18 @@ import sys
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest
|
||||||
from django.test import RequestFactory, TestCase
|
from django.test import TestCase
|
||||||
from django.utils.log import AdminEmailHandler
|
from django.utils.log import AdminEmailHandler
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from mock import MagicMock, patch
|
from mock import MagicMock, patch
|
||||||
from mypy_extensions import NoReturn
|
from mypy_extensions import NoReturn
|
||||||
from typing import Any, Callable, Dict, Mapping, Optional, Iterator, Optional, Tuple, Type
|
from typing import Any, Callable, Dict, Iterator, Optional, Tuple, Type
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
|
||||||
from zerver.lib.request import JsonableError
|
|
||||||
from zerver.lib.types import ViewFuncT
|
from zerver.lib.types import ViewFuncT
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.logging_handlers import AdminNotifyHandler
|
from zerver.logging_handlers import AdminNotifyHandler
|
||||||
from zerver.middleware import JsonErrorHandler
|
|
||||||
from zerver.worker.queue_processors import QueueProcessingWorker
|
|
||||||
|
|
||||||
captured_request = None # type: Optional[HttpRequest]
|
captured_request = None # type: Optional[HttpRequest]
|
||||||
captured_exc_info = None # type: Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
captured_exc_info = None # type: Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import email
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from email.mime.text import MIMEText
|
|
||||||
from email.utils import parseaddr
|
from email.utils import parseaddr
|
||||||
from mock import MagicMock, patch, call
|
from mock import MagicMock, patch, call
|
||||||
from typing import List, Dict, Any, Optional
|
from typing import List, Dict, Any, Optional
|
||||||
|
@ -13,7 +11,7 @@ from typing import List, Dict, Any, Optional
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from zerver.lib.actions import do_create_user, do_deactivate_realm, do_reactivate_realm
|
from zerver.lib.actions import do_create_user
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError, check_config
|
from zerver.lib.management import ZulipBaseCommand, CommandError, check_config
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import stdout_suppressed
|
from zerver.lib.test_helpers import stdout_suppressed
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Dict, Generator, Mapping, Union
|
from typing import Any, Dict, Mapping, Union
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ from zerver.lib.test_classes import (
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_stream_recipient,
|
get_stream_recipient,
|
||||||
Recipient,
|
|
||||||
Subscription,
|
Subscription,
|
||||||
UserPresence,
|
UserPresence,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.db.models import Q, Max
|
from django.db.models import Q
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.timezone import utc as timezone_utc
|
|
||||||
|
|
||||||
from zerver.lib import bugdown
|
from zerver.lib import bugdown
|
||||||
from zerver.decorator import JsonableError
|
from zerver.decorator import JsonableError
|
||||||
from zerver.lib.test_runner import slow
|
from zerver.lib.test_runner import slow
|
||||||
from zerver.lib.cache import get_stream_cache_key, cache_delete
|
from zerver.lib.cache import get_stream_cache_key, cache_delete
|
||||||
from zerver.lib.message import estimate_recent_messages
|
|
||||||
|
|
||||||
from zerver.lib.addressee import Addressee
|
from zerver.lib.addressee import Addressee
|
||||||
|
|
||||||
|
@ -96,11 +94,10 @@ from zerver.lib.url_encoding import near_message_url
|
||||||
|
|
||||||
from zerver.views.messages import create_mirrored_message_users
|
from zerver.views.messages import create_mirrored_message_users
|
||||||
|
|
||||||
from analytics.lib.counts import CountStat, LoggingCountStat, COUNT_STATS
|
from analytics.lib.counts import COUNT_STATS
|
||||||
from analytics.models import RealmCount
|
from analytics.models import RealmCount
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import DNS
|
|
||||||
import mock
|
import mock
|
||||||
import time
|
import time
|
||||||
import ujson
|
import ujson
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
|
|
||||||
import ujson
|
|
||||||
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from mock import patch
|
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.stream_topic import StreamTopicTarget
|
from zerver.lib.stream_topic import StreamTopicTarget
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
get_stream_recipient,
|
get_stream_recipient,
|
||||||
get_user,
|
|
||||||
Recipient,
|
|
||||||
UserProfile,
|
UserProfile,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,17 @@
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from sqlalchemy.sql import (
|
from sqlalchemy.sql import (
|
||||||
and_, select, column, table, literal, join, literal_column,
|
and_, select, column, table,
|
||||||
)
|
)
|
||||||
from sqlalchemy.sql import compiler
|
from sqlalchemy.sql import compiler
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
Realm, Stream, Subscription, UserProfile, Attachment,
|
Realm, Subscription,
|
||||||
get_display_recipient, get_personal_recipient, get_realm, get_stream, get_user,
|
get_display_recipient, get_personal_recipient, get_realm, get_stream,
|
||||||
Reaction, UserMessage, get_stream_recipient, Message
|
UserMessage, get_stream_recipient, Message
|
||||||
)
|
)
|
||||||
from zerver.lib.message import (
|
from zerver.lib.message import (
|
||||||
MessageDict,
|
MessageDict,
|
||||||
get_first_visible_message_id,
|
|
||||||
)
|
)
|
||||||
from zerver.lib.narrow import (
|
from zerver.lib.narrow import (
|
||||||
build_narrow_filter,
|
build_narrow_filter,
|
||||||
|
@ -46,7 +45,7 @@ from zerver.views.messages import (
|
||||||
LARGER_THAN_MAX_MESSAGE_ID,
|
LARGER_THAN_MAX_MESSAGE_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
from typing import Dict, List, Mapping, Sequence, Tuple, Generic, Union, Any, Optional
|
from typing import Dict, List, Sequence, Tuple, Union, Any, Optional
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.contrib.auth.signals import user_logged_in
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import ujson
|
import ujson
|
||||||
|
@ -7,29 +5,24 @@ import ldap
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django_auth_ldap.config import LDAPSearch
|
from django_auth_ldap.config import LDAPSearch
|
||||||
from email.utils import formataddr
|
from email.utils import formataddr
|
||||||
from mock import patch, MagicMock
|
from mock import patch, MagicMock
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from zerver.lib.notifications import fix_emojis, handle_missedmessage_emails, \
|
from zerver.lib.notifications import fix_emojis, handle_missedmessage_emails, \
|
||||||
enqueue_welcome_emails, relative_to_full_url
|
enqueue_welcome_emails, relative_to_full_url
|
||||||
from zerver.lib.actions import do_update_message, do_change_notification_settings
|
from zerver.lib.actions import do_change_notification_settings
|
||||||
from zerver.lib.message import access_message
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
from zerver.lib.test_helpers import MockLDAP
|
from zerver.lib.test_helpers import MockLDAP
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_realm,
|
get_realm,
|
||||||
get_stream,
|
get_stream,
|
||||||
Recipient,
|
|
||||||
UserMessage,
|
|
||||||
UserProfile,
|
UserProfile,
|
||||||
ScheduledEmail
|
ScheduledEmail
|
||||||
)
|
)
|
||||||
from zerver.lib.test_helpers import get_test_image_file
|
|
||||||
|
|
||||||
class TestFollowupEmails(ZulipTestCase):
|
class TestFollowupEmails(ZulipTestCase):
|
||||||
def test_day1_email_context(self) -> None:
|
def test_day1_email_context(self) -> None:
|
||||||
|
|
|
@ -5,10 +5,7 @@ import logging
|
||||||
import mock
|
import mock
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from builtins import object
|
from typing import Any, Optional
|
||||||
from django.test import override_settings
|
|
||||||
from requests import Response
|
|
||||||
from typing import Any, Dict, Tuple, Optional
|
|
||||||
|
|
||||||
from zerver.lib.outgoing_webhook import (
|
from zerver.lib.outgoing_webhook import (
|
||||||
do_rest_call,
|
do_rest_call,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.test import override_settings
|
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
|
|
@ -5,28 +5,24 @@ import itertools
|
||||||
import requests
|
import requests
|
||||||
import mock
|
import mock
|
||||||
from mock import call
|
from mock import call
|
||||||
import time
|
from typing import Any, Dict, List, Optional
|
||||||
from typing import Any, Dict, List, Optional, Union, SupportsInt
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import gcm
|
import gcm
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import ujson
|
import ujson
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.test import TestCase, override_settings
|
from django.test import override_settings
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.timezone import now as timezone_now
|
|
||||||
from django.utils.timezone import utc as timezone_utc
|
from django.utils.timezone import utc as timezone_utc
|
||||||
|
|
||||||
from analytics.lib.counts import CountStat, LoggingCountStat
|
from analytics.lib.counts import CountStat, LoggingCountStat
|
||||||
from analytics.models import InstallationCount, RealmCount
|
from analytics.models import InstallationCount, RealmCount
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
PushDeviceToken,
|
PushDeviceToken,
|
||||||
UserProfile,
|
|
||||||
Message,
|
Message,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
receives_offline_email_notifications,
|
receives_offline_email_notifications,
|
||||||
|
@ -47,7 +43,6 @@ from zerver.lib.push_notifications import get_mobile_push_content, \
|
||||||
from zerver.lib.remote_server import send_analytics_to_remote_server, \
|
from zerver.lib.remote_server import send_analytics_to_remote_server, \
|
||||||
build_analytics_data, PushNotificationBouncerException
|
build_analytics_data, PushNotificationBouncerException
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.response import json_success
|
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
|
@ -877,7 +872,6 @@ class TestAPNs(PushNotificationTest):
|
||||||
self.user_profile.id, device.token)
|
self.user_profile.id, device.token)
|
||||||
|
|
||||||
def test_http_retry_pipefail(self) -> None:
|
def test_http_retry_pipefail(self) -> None:
|
||||||
import hyper
|
|
||||||
with self.mock_apns() as mock_apns, \
|
with self.mock_apns() as mock_apns, \
|
||||||
mock.patch('zerver.lib.push_notifications.logger') as mock_logging:
|
mock.patch('zerver.lib.push_notifications.logger') as mock_logging:
|
||||||
mock_apns.get_notification_result.side_effect = itertools.chain(
|
mock_apns.get_notification_result.side_effect = itertools.chain(
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import mock
|
import mock
|
||||||
import os
|
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
import ujson
|
|
||||||
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from pika.exceptions import ConnectionClosed, AMQPConnectionError
|
from pika.exceptions import ConnectionClosed, AMQPConnectionError
|
||||||
|
|
||||||
from zerver.lib.queue import TornadoQueueClient, queue_json_publish, \
|
from zerver.lib.queue import TornadoQueueClient, queue_json_publish, \
|
||||||
get_queue_client, SimpleQueueClient
|
get_queue_client
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
|
||||||
class TestTornadoQueueClient(ZulipTestCase):
|
class TestTornadoQueueClient(ZulipTestCase):
|
||||||
|
|
|
@ -5,8 +5,7 @@ import ujson
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse
|
from django.test import override_settings
|
||||||
from django.test import TestCase, override_settings
|
|
||||||
from mock import patch, MagicMock
|
from mock import patch, MagicMock
|
||||||
from typing import Any, Callable, Dict, List, Mapping, Tuple
|
from typing import Any, Callable, Dict, List, Mapping, Tuple
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,9 @@ from unittest import mock
|
||||||
|
|
||||||
from zerver.lib.emoji import emoji_name_to_emoji_code
|
from zerver.lib.emoji import emoji_name_to_emoji_code
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.test_helpers import tornado_redirected_to_list, \
|
from zerver.lib.test_helpers import tornado_redirected_to_list
|
||||||
get_test_image_file
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import get_realm, Message, Reaction, RealmEmoji, Recipient, UserMessage
|
from zerver.models import get_realm, Message, Reaction, RealmEmoji, UserMessage
|
||||||
|
|
||||||
class ReactionEmojiTest(ZulipTestCase):
|
class ReactionEmojiTest(ZulipTestCase):
|
||||||
def test_missing_emoji(self) -> None:
|
def test_missing_emoji(self) -> None:
|
||||||
|
|
|
@ -6,10 +6,7 @@ import mock
|
||||||
from email.utils import parseaddr
|
from email.utils import parseaddr
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse
|
from typing import Any, Dict, List, Mapping
|
||||||
from django.conf import settings
|
|
||||||
from mock import patch
|
|
||||||
from typing import Any, Dict, List, Union, Mapping
|
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
do_change_is_admin,
|
do_change_is_admin,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.utils import IntegrityError
|
from django.db.utils import IntegrityError
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from zerver.lib.actions import do_change_is_admin, \
|
from zerver.lib.actions import do_change_is_admin, \
|
||||||
do_change_realm_domain, do_create_realm, \
|
do_change_realm_domain, do_create_realm, \
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from zerver.lib.actions import do_create_realm, do_create_user, \
|
from zerver.lib.actions import do_create_realm, do_create_user, \
|
||||||
do_remove_realm_emoji, get_realm, check_add_realm_emoji
|
get_realm, check_add_realm_emoji
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import get_test_image_file, get_user
|
from zerver.lib.test_helpers import get_test_image_file
|
||||||
from zerver.models import Realm, RealmEmoji, UserProfile
|
from zerver.models import Realm, RealmEmoji, UserProfile
|
||||||
|
|
||||||
class RealmEmojiTest(ZulipTestCase):
|
class RealmEmojiTest(ZulipTestCase):
|
||||||
|
|
|
@ -10,7 +10,6 @@ from zerver.lib.utils import statsd
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import ujson
|
import ujson
|
||||||
import os
|
|
||||||
|
|
||||||
def fix_params(raw_params: Dict[str, Any]) -> Dict[str, str]:
|
def fix_params(raw_params: Dict[str, Any]) -> Dict[str, str]:
|
||||||
# A few of our few legacy endpoints need their
|
# A few of our few legacy endpoints need their
|
||||||
|
|
|
@ -5,7 +5,7 @@ from datetime import datetime, timedelta
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.upload import create_attachment
|
from zerver.lib.upload import create_attachment
|
||||||
from zerver.models import Message, Realm, Recipient, UserProfile, UserMessage, ArchivedUserMessage, \
|
from zerver.models import Message, Realm, UserMessage, ArchivedUserMessage, \
|
||||||
ArchivedMessage, Attachment, ArchivedAttachment
|
ArchivedMessage, Attachment, ArchivedAttachment
|
||||||
from zerver.lib.retention import get_expired_messages, move_messages_to_archive
|
from zerver.lib.retention import get_expired_messages, move_messages_to_archive
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import json
|
|
||||||
import mock
|
import mock
|
||||||
from typing import Any, Union, Mapping, Callable
|
from typing import Any, Union, Mapping, Callable
|
||||||
|
|
||||||
|
@ -18,7 +17,6 @@ from zerver.lib.bot_config import set_bot_config, ConfigError, load_bot_config_t
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_realm,
|
get_realm,
|
||||||
BotStorageData,
|
|
||||||
UserProfile,
|
UserProfile,
|
||||||
Recipient,
|
Recipient,
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.sessions import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
UserProfile, get_user_profile_by_id, get_realm, Realm
|
get_realm, Realm
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
|
|
@ -11,7 +11,7 @@ from zerver.lib.sessions import get_session_dict_user
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import MockLDAP
|
from zerver.lib.test_helpers import MockLDAP
|
||||||
from zerver.lib.users import get_all_api_keys
|
from zerver.lib.users import get_all_api_keys
|
||||||
from zerver.models import get_realm, get_user, UserProfile, \
|
from zerver.models import get_realm, UserProfile, \
|
||||||
get_user_profile_by_api_key
|
get_user_profile_by_api_key
|
||||||
|
|
||||||
class ChangeSettingsTest(ZulipTestCase):
|
class ChangeSettingsTest(ZulipTestCase):
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import datetime
|
import datetime
|
||||||
from email.utils import parseaddr
|
from email.utils import parseaddr
|
||||||
import re
|
|
||||||
|
|
||||||
import django_otp
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpResponse
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from two_factor.utils import default_device
|
|
||||||
|
|
||||||
from mock import patch, MagicMock
|
from mock import patch, MagicMock
|
||||||
from zerver.lib.test_helpers import MockLDAP, get_test_image_file, avatar_disk_path
|
from zerver.lib.test_helpers import get_test_image_file, avatar_disk_path
|
||||||
|
|
||||||
from confirmation.models import Confirmation, create_confirmation_link, MultiuseInvite, \
|
from confirmation.models import Confirmation, create_confirmation_link, MultiuseInvite, \
|
||||||
generate_key, confirmation_url, get_object_from_key, ConfirmationKeyException, \
|
generate_key, confirmation_url, get_object_from_key, ConfirmationKeyException, \
|
||||||
|
@ -21,19 +18,17 @@ from confirmation.models import Confirmation, create_confirmation_link, Multiuse
|
||||||
from confirmation import settings as confirmation_settings
|
from confirmation import settings as confirmation_settings
|
||||||
|
|
||||||
from zerver.forms import HomepageForm, WRONG_SUBDOMAIN_ERROR, check_subdomain_available
|
from zerver.forms import HomepageForm, WRONG_SUBDOMAIN_ERROR, check_subdomain_available
|
||||||
from zerver.lib.actions import do_change_password, get_default_streams_for_realm
|
from zerver.lib.actions import get_default_streams_for_realm
|
||||||
from zerver.lib.exceptions import CannotDeactivateLastUserError
|
|
||||||
from zerver.lib.dev_ldap_directory import init_fakeldap
|
from zerver.lib.dev_ldap_directory import init_fakeldap
|
||||||
from zerver.decorator import do_two_factor_login
|
from zerver.decorator import do_two_factor_login
|
||||||
from zerver.views.auth import login_or_register_remote_user, \
|
from zerver.views.auth import \
|
||||||
redirect_and_log_into_subdomain, start_two_factor_auth
|
redirect_and_log_into_subdomain, start_two_factor_auth
|
||||||
from zerver.views.invite import get_invitee_emails_set
|
from zerver.views.invite import get_invitee_emails_set
|
||||||
from zerver.views.registration import send_confirm_registration_email
|
|
||||||
from zerver.views.development.registration import confirmation_key
|
from zerver.views.development.registration import confirmation_key
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_realm, get_user, get_stream_recipient, get_realm_stream,
|
get_realm, get_user, get_stream_recipient, get_realm_stream,
|
||||||
PreregistrationUser, Realm, RealmDomain, Recipient, Message,
|
PreregistrationUser, Realm, Recipient, Message,
|
||||||
ScheduledEmail, UserProfile, UserMessage,
|
ScheduledEmail, UserProfile, UserMessage,
|
||||||
Stream, Subscription, flush_per_request_caches
|
Stream, Subscription, flush_per_request_caches
|
||||||
)
|
)
|
||||||
|
@ -41,7 +36,6 @@ from zerver.lib.actions import (
|
||||||
set_default_streams,
|
set_default_streams,
|
||||||
do_change_is_admin,
|
do_change_is_admin,
|
||||||
get_stream,
|
get_stream,
|
||||||
do_create_realm,
|
|
||||||
do_create_default_stream_group,
|
do_create_default_stream_group,
|
||||||
do_add_default_stream,
|
do_add_default_stream,
|
||||||
)
|
)
|
||||||
|
@ -53,7 +47,6 @@ from zerver.lib.actions import (
|
||||||
do_set_realm_property,
|
do_set_realm_property,
|
||||||
add_new_user_history,
|
add_new_user_history,
|
||||||
)
|
)
|
||||||
from zerver.lib.avatar import avatar_url
|
|
||||||
from zerver.lib.mobile_auth_otp import xor_hex_strings, ascii_to_hex, \
|
from zerver.lib.mobile_auth_otp import xor_hex_strings, ascii_to_hex, \
|
||||||
otp_encrypt_api_key, is_valid_otp, hex_to_ascii, otp_decrypt_api_key
|
otp_encrypt_api_key, is_valid_otp, hex_to_ascii, otp_decrypt_api_key
|
||||||
from zerver.lib.notifications import enqueue_welcome_emails, \
|
from zerver.lib.notifications import enqueue_welcome_emails, \
|
||||||
|
@ -65,20 +58,17 @@ from zerver.lib.test_helpers import find_key_by_email, queries_captured, \
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_runner import slow
|
|
||||||
from zerver.lib.sessions import get_session_dict_user
|
from zerver.lib.sessions import get_session_dict_user
|
||||||
from zerver.lib.name_restrictions import is_disposable_domain
|
from zerver.lib.name_restrictions import is_disposable_domain
|
||||||
from zerver.context_processors import common_context
|
from zerver.context_processors import common_context
|
||||||
|
|
||||||
from collections import defaultdict
|
|
||||||
import re
|
import re
|
||||||
import smtplib
|
import smtplib
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Set
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
import os
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
class RedirectAndLogIntoSubdomainTestCase(ZulipTestCase):
|
class RedirectAndLogIntoSubdomainTestCase(ZulipTestCase):
|
||||||
|
|
|
@ -5,9 +5,6 @@ from django.utils.timezone import now as timezone_now
|
||||||
from zerver.data_import.slack import (
|
from zerver.data_import.slack import (
|
||||||
rm_tree,
|
rm_tree,
|
||||||
get_slack_api_data,
|
get_slack_api_data,
|
||||||
get_user_email,
|
|
||||||
build_avatar_url,
|
|
||||||
build_avatar,
|
|
||||||
get_admin,
|
get_admin,
|
||||||
get_user_timezone,
|
get_user_timezone,
|
||||||
users_to_zerver_userprofile,
|
users_to_zerver_userprofile,
|
||||||
|
@ -18,7 +15,6 @@ from zerver.data_import.slack import (
|
||||||
channel_message_to_zerver_message,
|
channel_message_to_zerver_message,
|
||||||
convert_slack_workspace_messages,
|
convert_slack_workspace_messages,
|
||||||
do_convert_data,
|
do_convert_data,
|
||||||
process_avatars,
|
|
||||||
process_message_files,
|
process_message_files,
|
||||||
AddedChannelsT,
|
AddedChannelsT,
|
||||||
ZerverFieldsT,
|
ZerverFieldsT,
|
||||||
|
@ -36,9 +32,6 @@ from zerver.data_import.sequencer import (
|
||||||
from zerver.lib.import_realm import (
|
from zerver.lib.import_realm import (
|
||||||
do_import_realm,
|
do_import_realm,
|
||||||
)
|
)
|
||||||
from zerver.lib.avatar_hash import (
|
|
||||||
user_avatar_path_from_ids,
|
|
||||||
)
|
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
|
@ -51,16 +44,13 @@ from zerver.models import (
|
||||||
RealmAuditLog,
|
RealmAuditLog,
|
||||||
Recipient,
|
Recipient,
|
||||||
)
|
)
|
||||||
from zerver.lib import mdiff
|
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
import mock
|
import mock
|
||||||
from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple, Iterator
|
from typing import Any, Dict, List, Set, Tuple, Iterator
|
||||||
|
|
||||||
def remove_folder(path: str) -> None:
|
def remove_folder(path: str) -> None:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from zerver.data_import.slack_message_conversion import (
|
from zerver.data_import.slack_message_conversion import (
|
||||||
convert_to_zulip_markdown,
|
convert_to_zulip_markdown,
|
||||||
get_user_full_name
|
get_user_full_name
|
||||||
|
@ -13,7 +11,7 @@ from zerver.lib import mdiff
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
class SlackMessageConversion(ZulipTestCase):
|
class SlackMessageConversion(ZulipTestCase):
|
||||||
def assertEqual(self, first: Any, second: Any, msg: str="") -> None:
|
def assertEqual(self, first: Any, second: Any, msg: str="") -> None:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.soft_deactivation import (
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
Client, UserProfile, UserActivity, get_realm, Recipient
|
Client, UserProfile, UserActivity, get_realm,
|
||||||
)
|
)
|
||||||
|
|
||||||
class UserSoftDeactivationTests(ZulipTestCase):
|
class UserSoftDeactivationTests(ZulipTestCase):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import mock
|
import mock
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase
|
||||||
|
|
||||||
from zerver.lib.subdomains import get_subdomain
|
from zerver.lib.subdomains import get_subdomain
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Dict, List, Mapping, Optional, Sequence, Set
|
from typing import Any, Dict, List, Mapping, Optional, Set
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.test import override_settings
|
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.lib import cache
|
from zerver.lib import cache
|
||||||
|
@ -42,7 +41,7 @@ from zerver.lib.test_runner import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
get_display_recipient, Message, Realm, Recipient, Stream, Subscription,
|
Realm, Recipient, Stream, Subscription,
|
||||||
DefaultStream, UserProfile, get_user_profile_by_id, active_non_guest_user_ids,
|
DefaultStream, UserProfile, get_user_profile_by_id, active_non_guest_user_ids,
|
||||||
get_default_stream_groups, flush_per_request_caches, DefaultStreamGroup,
|
get_default_stream_groups, flush_per_request_caches, DefaultStreamGroup,
|
||||||
get_client, get_user
|
get_client, get_user
|
||||||
|
@ -53,7 +52,7 @@ from zerver.lib.actions import (
|
||||||
do_create_realm, do_remove_default_stream, bulk_get_subscriber_user_ids,
|
do_create_realm, do_remove_default_stream, bulk_get_subscriber_user_ids,
|
||||||
gather_subscriptions_helper, bulk_add_subscriptions, bulk_remove_subscriptions,
|
gather_subscriptions_helper, bulk_add_subscriptions, bulk_remove_subscriptions,
|
||||||
gather_subscriptions, get_default_streams_for_realm, get_realm, get_stream,
|
gather_subscriptions, get_default_streams_for_realm, get_realm, get_stream,
|
||||||
set_default_streams, check_stream_name, do_get_streams,
|
set_default_streams, do_get_streams,
|
||||||
create_stream_if_needed, create_streams_if_needed,
|
create_stream_if_needed, create_streams_if_needed,
|
||||||
ensure_stream,
|
ensure_stream,
|
||||||
do_deactivate_stream,
|
do_deactivate_stream,
|
||||||
|
@ -64,7 +63,6 @@ from zerver.lib.actions import (
|
||||||
do_remove_default_stream_group,
|
do_remove_default_stream_group,
|
||||||
do_change_default_stream_group_description,
|
do_change_default_stream_group_description,
|
||||||
do_change_default_stream_group_name,
|
do_change_default_stream_group_name,
|
||||||
do_rename_stream,
|
|
||||||
lookup_default_stream_groups,
|
lookup_default_stream_groups,
|
||||||
can_access_stream_user_ids,
|
can_access_stream_user_ids,
|
||||||
validate_user_access_to_subscribers_helper,
|
validate_user_access_to_subscribers_helper,
|
||||||
|
@ -81,12 +79,10 @@ from zerver.lib.message import (
|
||||||
)
|
)
|
||||||
from zerver.lib.stream_recipient import StreamRecipientMap
|
from zerver.lib.stream_recipient import StreamRecipientMap
|
||||||
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import mock
|
import mock
|
||||||
import random
|
import random
|
||||||
import ujson
|
import ujson
|
||||||
import urllib
|
|
||||||
|
|
||||||
class TestMiscStuff(ZulipTestCase):
|
class TestMiscStuff(ZulipTestCase):
|
||||||
def test_empty_results(self) -> None:
|
def test_empty_results(self) -> None:
|
||||||
|
|
|
@ -5,9 +5,7 @@ import re
|
||||||
from typing import Any, Dict, Iterable
|
from typing import Any, Dict, Iterable
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django.template import Template, Context
|
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
|
|
||||||
|
@ -17,7 +15,6 @@ from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_runner import slow
|
from zerver.lib.test_runner import slow
|
||||||
from zerver.context_processors import common_context
|
|
||||||
|
|
||||||
|
|
||||||
class get_form_value:
|
class get_form_value:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
use_s3_backend,
|
use_s3_backend,
|
||||||
create_s3_buckets,
|
create_s3_buckets,
|
||||||
|
|
|
@ -3,10 +3,10 @@ from django.utils.timezone import utc as timezone_utc
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import floor_to_hour, floor_to_day, ceiling_to_hour, \
|
from zerver.lib.timestamp import floor_to_hour, floor_to_day, ceiling_to_hour, \
|
||||||
ceiling_to_day, timestamp_to_datetime, datetime_to_timestamp, \
|
timestamp_to_datetime, datetime_to_timestamp, \
|
||||||
TimezoneNotUTCException, convert_to_UTC
|
TimezoneNotUTCException, convert_to_UTC
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import timedelta
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import message_stream_count, most_recent_message
|
from zerver.lib.test_helpers import message_stream_count, most_recent_message
|
||||||
from zerver.models import get_realm, get_user, Recipient, UserProfile
|
from zerver.models import get_realm, get_user, UserProfile
|
||||||
|
|
||||||
from typing import Any, Dict
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
class TutorialTests(ZulipTestCase):
|
class TutorialTests(ZulipTestCase):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.test_helpers import tornado_redirected_to_list
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.models import get_realm, get_user, get_display_recipient
|
from zerver.models import get_display_recipient
|
||||||
|
|
||||||
class TypingNotificationOperatorTest(ZulipTestCase):
|
class TypingNotificationOperatorTest(ZulipTestCase):
|
||||||
def test_missing_parameter(self) -> None:
|
def test_missing_parameter(self) -> None:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-AA
|
# -*- coding: utf-8 -*-AA
|
||||||
|
|
||||||
from typing import Any, Dict, List, Mapping
|
from typing import Any, List, Mapping
|
||||||
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
@ -10,8 +10,6 @@ from zerver.models import (
|
||||||
get_stream,
|
get_stream,
|
||||||
get_stream_recipient,
|
get_stream_recipient,
|
||||||
get_user,
|
get_user,
|
||||||
Recipient,
|
|
||||||
Stream,
|
|
||||||
Subscription,
|
Subscription,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from unittest import skip
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from zerver.lib.avatar import (
|
from zerver.lib.avatar import (
|
||||||
|
@ -16,12 +15,10 @@ from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
avatar_disk_path,
|
avatar_disk_path,
|
||||||
get_test_image_file,
|
get_test_image_file,
|
||||||
POSTRequestMock,
|
|
||||||
use_s3_backend,
|
use_s3_backend,
|
||||||
create_s3_buckets,
|
create_s3_buckets,
|
||||||
queries_captured,
|
queries_captured,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_runner import slow
|
|
||||||
from zerver.lib.upload import sanitize_name, S3UploadBackend, \
|
from zerver.lib.upload import sanitize_name, S3UploadBackend, \
|
||||||
upload_message_file, upload_emoji_image, delete_message_image, LocalUploadBackend, \
|
upload_message_file, upload_emoji_image, delete_message_image, LocalUploadBackend, \
|
||||||
ZulipUploadBackend, MEDIUM_AVATAR_SIZE, resize_avatar, \
|
ZulipUploadBackend, MEDIUM_AVATAR_SIZE, resize_avatar, \
|
||||||
|
@ -30,7 +27,7 @@ from zerver.lib.upload import sanitize_name, S3UploadBackend, \
|
||||||
exif_rotate
|
exif_rotate
|
||||||
import zerver.lib.upload
|
import zerver.lib.upload
|
||||||
from zerver.models import Attachment, get_user, \
|
from zerver.models import Attachment, get_user, \
|
||||||
get_old_unclaimed_attachments, Message, UserProfile, Stream, Realm, \
|
Message, UserProfile, Realm, \
|
||||||
RealmDomain, RealmEmoji, get_realm, get_system_bot, \
|
RealmDomain, RealmEmoji, get_realm, get_system_bot, \
|
||||||
validate_attachment_request
|
validate_attachment_request
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
@ -39,14 +36,12 @@ from zerver.lib.actions import (
|
||||||
internal_send_private_message,
|
internal_send_private_message,
|
||||||
)
|
)
|
||||||
from zerver.lib.create_user import copy_user_settings
|
from zerver.lib.create_user import copy_user_settings
|
||||||
from zerver.lib.request import JsonableError
|
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
from zerver.views.upload import upload_file_backend, serve_local
|
from zerver.views.upload import upload_file_backend
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from boto.s3.key import Key
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
|
@ -54,15 +49,9 @@ import io
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
import requests
|
|
||||||
import base64
|
|
||||||
from datetime import timedelta
|
|
||||||
from django.http import HttpRequest
|
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from sendfile import _get_sendfile
|
from sendfile import _get_sendfile
|
||||||
|
|
||||||
from typing import Any, Callable
|
|
||||||
|
|
||||||
def destroy_uploads() -> None:
|
def destroy_uploads() -> None:
|
||||||
if os.path.exists(settings.LOCAL_UPLOADS_DIR):
|
if os.path.exists(settings.LOCAL_UPLOADS_DIR):
|
||||||
shutil.rmtree(settings.LOCAL_UPLOADS_DIR)
|
shutil.rmtree(settings.LOCAL_UPLOADS_DIR)
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from typing import Any, List, Optional
|
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
import django
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
@ -22,7 +19,7 @@ from zerver.lib.user_groups import (
|
||||||
get_memberships_of_users,
|
get_memberships_of_users,
|
||||||
user_groups_in_realm_serialized,
|
user_groups_in_realm_serialized,
|
||||||
)
|
)
|
||||||
from zerver.models import UserProfile, UserGroup, get_realm, Realm, \
|
from zerver.models import UserGroup, get_realm, Realm, \
|
||||||
UserGroupMembership
|
UserGroupMembership
|
||||||
|
|
||||||
class UserGroupTestCase(ZulipTestCase):
|
class UserGroupTestCase(ZulipTestCase):
|
||||||
|
|
|
@ -3,29 +3,23 @@
|
||||||
from typing import (Any, Dict, Iterable, List, Mapping,
|
from typing import (Any, Dict, Iterable, List, Mapping,
|
||||||
Optional, TypeVar, Union)
|
Optional, TypeVar, Union)
|
||||||
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
queries_captured, simulated_empty_cache,
|
queries_captured, simulated_empty_cache,
|
||||||
tornado_redirected_to_list, get_subscription,
|
tornado_redirected_to_list, get_subscription,
|
||||||
most_recent_message, make_client, avatar_disk_path,
|
most_recent_message,
|
||||||
get_test_image_file
|
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import (
|
from zerver.lib.test_classes import (
|
||||||
ZulipTestCase,
|
ZulipTestCase,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_runner import slow
|
|
||||||
|
|
||||||
from zerver.models import UserProfile, Recipient, \
|
from zerver.models import UserProfile, Recipient, \
|
||||||
Realm, RealmDomain, UserActivity, UserHotspot, \
|
RealmDomain, UserHotspot, \
|
||||||
get_user, get_realm, get_client, get_stream, get_stream_recipient, \
|
get_user, get_realm, get_stream, get_stream_recipient, \
|
||||||
get_source_profile, Message, get_context_for_message, \
|
get_source_profile, \
|
||||||
ScheduledEmail, check_valid_user_ids, get_user, \
|
ScheduledEmail, check_valid_user_ids, \
|
||||||
get_user_by_id_in_realm_including_cross_realm, CustomProfileField
|
get_user_by_id_in_realm_including_cross_realm, CustomProfileField
|
||||||
|
|
||||||
from zerver.lib.avatar import avatar_url
|
from zerver.lib.avatar import avatar_url
|
||||||
from zerver.lib.email_mirror import create_missed_message_address
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.lib.send_email import send_future_email
|
from zerver.lib.send_email import send_future_email
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
@ -34,7 +28,6 @@ from zerver.lib.actions import (
|
||||||
do_deactivate_user,
|
do_deactivate_user,
|
||||||
do_reactivate_user,
|
do_reactivate_user,
|
||||||
do_change_is_admin,
|
do_change_is_admin,
|
||||||
do_change_is_guest,
|
|
||||||
do_create_user,
|
do_create_user,
|
||||||
)
|
)
|
||||||
from zerver.lib.create_user import copy_user_settings
|
from zerver.lib.create_user import copy_user_settings
|
||||||
|
@ -43,13 +36,8 @@ from zerver.lib.stream_topic import StreamTopicTarget
|
||||||
from zerver.lib.users import user_ids_to_users, access_user_by_id, \
|
from zerver.lib.users import user_ids_to_users, access_user_by_id, \
|
||||||
get_accounts_for_email
|
get_accounts_for_email
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import mock
|
import mock
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
K = TypeVar('K')
|
K = TypeVar('K')
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ujson
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from mock import patch
|
from mock import patch
|
||||||
from typing import Any, Dict
|
from typing import Any
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
|
|
Loading…
Reference in New Issue