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 (
|
||||
Recipient,
|
||||
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, \
|
||||
do_activate_user, do_reactivate_user, do_change_password, \
|
||||
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
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
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.test import override_settings
|
||||
from django_auth_ldap.backend import _LDAPUser
|
||||
from django.contrib.auth import authenticate
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
||||
from builtins import object
|
||||
from oauth2client.crypt import AppIdentityError
|
||||
from django.core import signing
|
||||
from django.urls import reverse
|
||||
import httpretty
|
||||
import os
|
||||
import sys
|
||||
|
||||
import jwt
|
||||
import mock
|
||||
|
@ -22,7 +19,6 @@ import re
|
|||
import time
|
||||
import datetime
|
||||
|
||||
from zerver.forms import HomepageForm
|
||||
from zerver.lib.actions import (
|
||||
do_deactivate_realm,
|
||||
do_deactivate_user,
|
||||
|
@ -44,13 +40,12 @@ from zerver.lib.sessions import get_session_dict_user
|
|||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
)
|
||||
from zerver.lib.test_helpers import POSTRequestMock, HostRequestMock
|
||||
from zerver.models import \
|
||||
get_realm, email_to_username, UserProfile, \
|
||||
PreregistrationUser, Realm, get_user, MultiuseInvite
|
||||
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, \
|
||||
GoogleMobileOauth2Backend, ZulipRemoteUserBackend, ZulipLDAPAuthBackend, \
|
||||
|
@ -61,19 +56,15 @@ from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
|
|||
ZulipLDAPException, sync_user_from_ldap
|
||||
|
||||
from zerver.views.auth import (maybe_send_to_registration,
|
||||
login_or_register_remote_user,
|
||||
_subdomain_token_salt)
|
||||
from version import ZULIP_VERSION
|
||||
|
||||
from social_core.exceptions import AuthFailed, AuthStateForbidden
|
||||
from social_django.strategy import DjangoStrategy
|
||||
from social_django.storage import BaseDjangoStorage
|
||||
from social_core.backends.github import GithubOrganizationOAuth2, GithubTeamOAuth2, \
|
||||
GithubOAuth2
|
||||
|
||||
import json
|
||||
import urllib
|
||||
from http.cookies import SimpleCookie
|
||||
import ujson
|
||||
from zerver.lib.test_helpers import MockLDAP, load_subdomain_token
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import os
|
|||
import ujson
|
||||
|
||||
from django.core import mail
|
||||
from django.http import HttpResponse
|
||||
from django.test import override_settings
|
||||
from mock import patch, MagicMock
|
||||
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.bot_config import get_bot_config
|
||||
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
|
||||
from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
||||
from zerver.lib.test_helpers import (
|
||||
|
|
|
@ -7,10 +7,8 @@ from zerver.lib.actions import (
|
|||
do_set_user_display_setting,
|
||||
do_remove_realm_emoji,
|
||||
do_set_alert_words,
|
||||
get_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.emoji import get_emoji_url
|
||||
from zerver.lib.exceptions import BugdownRenderingException
|
||||
|
@ -40,7 +38,6 @@ from zerver.models import (
|
|||
Realm,
|
||||
RealmEmoji,
|
||||
RealmFilter,
|
||||
Recipient,
|
||||
UserProfile,
|
||||
UserGroup,
|
||||
)
|
||||
|
@ -50,8 +47,7 @@ import mock
|
|||
import os
|
||||
import ujson
|
||||
|
||||
import urllib
|
||||
from typing import cast, Any, AnyStr, Dict, List, Optional, Set, Tuple
|
||||
from typing import cast, Any, Dict, List, Optional, Set, Tuple
|
||||
|
||||
class FakeMessage:
|
||||
pass
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Union, List, Dict, Any
|
||||
from mock import patch
|
||||
|
||||
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, \
|
||||
|
|
|
@ -6,11 +6,9 @@ import os
|
|||
from collections import defaultdict
|
||||
|
||||
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.test.client import RequestFactory
|
||||
from django.conf import settings
|
||||
|
||||
from zerver.forms import OurAuthenticationForm
|
||||
|
@ -23,7 +21,6 @@ from zerver.lib.test_helpers import (
|
|||
)
|
||||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
WebhookTestCase,
|
||||
)
|
||||
from zerver.lib.response import json_response, json_success
|
||||
from zerver.lib.users import get_api_key
|
||||
|
@ -39,7 +36,7 @@ from zerver.decorator import (
|
|||
authenticated_uploads_api_view,
|
||||
authenticate_notify, cachify,
|
||||
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,
|
||||
zulip_login_required
|
||||
)
|
||||
|
@ -50,7 +47,7 @@ from zerver.lib.validator import (
|
|||
check_string_fixed_length, check_capped_string, check_color
|
||||
)
|
||||
from zerver.models import \
|
||||
get_realm, get_user, UserProfile, Client, Realm, Recipient
|
||||
get_realm, get_user, UserProfile, Realm
|
||||
|
||||
import ujson
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import mock
|
||||
import os
|
||||
import subprocess
|
||||
import ujson
|
||||
|
@ -19,7 +18,6 @@ from zerver.lib.utils import split_by
|
|||
from zerver.models import Realm, get_realm
|
||||
from zerver.views.integrations import (
|
||||
add_api_uri_context,
|
||||
add_integrations_context,
|
||||
)
|
||||
|
||||
class DocPageTest(ZulipTestCase):
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import datetime
|
||||
from typing import Any
|
||||
from email.utils import parseaddr, formataddr
|
||||
from email.utils import parseaddr
|
||||
import re
|
||||
|
||||
import django
|
||||
import mock
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.http import HttpResponse
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import now
|
||||
|
||||
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 (
|
||||
ZulipTestCase,
|
||||
)
|
||||
from zerver.lib.send_email import FromAddress
|
||||
from zerver.models import get_user_by_delivery_email, EmailChangeStatus, Realm, get_realm, \
|
||||
get_user_profile_by_id, get_user, UserProfile
|
||||
from zerver.models import get_user_by_delivery_email, EmailChangeStatus, get_realm
|
||||
|
||||
|
||||
class EmailChangeTestCase(ZulipTestCase):
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.http import HttpResponse
|
|||
from zerver.lib.test_helpers import (
|
||||
most_recent_message,
|
||||
most_recent_usermessage,
|
||||
POSTRequestMock)
|
||||
)
|
||||
|
||||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
|
@ -32,21 +32,14 @@ from zerver.lib.email_mirror import (
|
|||
)
|
||||
|
||||
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.image import MIMEImage
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
|
||||
import re
|
||||
import ujson
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
from io import StringIO
|
||||
from django.conf import settings
|
||||
|
||||
from typing import Any, Callable, Dict, Mapping, Union, Optional
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from unittest import mock
|
||||
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.models import (
|
||||
UserProfile, Recipient, get_display_recipient,
|
||||
UserProfile, get_display_recipient,
|
||||
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.models import Recipient, Stream, Subscription, UserProfile, get_stream
|
||||
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
|
||||
from zerver.tornado.views import get_events
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
|
||||
# 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 shutil
|
||||
import sys
|
||||
|
@ -13,10 +13,10 @@ from django.utils.timezone import now as timezone_now
|
|||
from io import StringIO
|
||||
|
||||
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,
|
||||
Realm, Subscription, Stream, flush_per_request_caches, UserGroup, Service,
|
||||
Attachment, PreregistrationUser, UserStatus,
|
||||
Attachment, PreregistrationUser,
|
||||
)
|
||||
|
||||
from zerver.lib.actions import (
|
||||
|
@ -87,7 +87,6 @@ from zerver.lib.actions import (
|
|||
get_typing_user_profiles,
|
||||
log_event,
|
||||
lookup_default_stream_groups,
|
||||
notify_attachment_update,
|
||||
notify_realm_custom_profile_fields,
|
||||
check_add_user_group,
|
||||
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,
|
||||
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.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 collections import OrderedDict
|
||||
import mock
|
||||
import time
|
||||
import ujson
|
||||
|
|
|
@ -21,8 +21,6 @@ import DNS
|
|||
import mock
|
||||
import time
|
||||
|
||||
import urllib
|
||||
|
||||
class MITNameTest(ZulipTestCase):
|
||||
def test_valid_hesiod(self) -> None:
|
||||
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 -*-
|
||||
from django.conf import settings
|
||||
from django.utils.timezone import now as timezone_now
|
||||
|
||||
from zerver.lib.import_realm import (
|
||||
do_import_realm,
|
||||
)
|
||||
|
@ -11,11 +8,7 @@ from zerver.lib.test_classes import (
|
|||
from zerver.tests.test_import_export import (
|
||||
rm_tree,
|
||||
)
|
||||
from zerver.lib.test_helpers import (
|
||||
get_test_image_file,
|
||||
)
|
||||
from zerver.models import (
|
||||
Realm,
|
||||
get_realm,
|
||||
UserProfile,
|
||||
Message,
|
||||
|
@ -26,12 +19,10 @@ from zerver.data_import.gitter import (
|
|||
)
|
||||
|
||||
import ujson
|
||||
import json
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
import mock
|
||||
from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple
|
||||
from typing import Any, Dict, List, Set
|
||||
|
||||
class GitterImporter(ZulipTestCase):
|
||||
logger = logging.getLogger()
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
import ujson
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.test import override_settings
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from mock import MagicMock, patch
|
||||
import urllib
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, Dict
|
||||
|
||||
from zerver.lib.actions import do_create_user
|
||||
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.test_runner import slow
|
||||
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,
|
||||
)
|
||||
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.test_classes import ZulipTestCase
|
||||
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 mock
|
||||
|
||||
# Splitting this out, since I imagine this will eventually have most of the
|
||||
# complicated hotspots logic.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from typing import Any
|
||||
|
||||
import django
|
||||
import mock
|
||||
import ujson
|
||||
from django.test import TestCase
|
||||
|
@ -19,8 +18,6 @@ from zerver.lib.test_classes import (
|
|||
from zerver.management.commands import makemessages
|
||||
from zerver.lib.notifications import enqueue_welcome_emails
|
||||
|
||||
from django.utils.timezone import now as timezone_now
|
||||
|
||||
class EmailTranslationTestCase(ZulipTestCase):
|
||||
def test_email_translation(self) -> 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 shutil
|
||||
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, \
|
||||
FrozenSet
|
||||
|
||||
from zerver.lib.export import (
|
||||
do_export_realm,
|
||||
export_files_from_s3,
|
||||
export_usermessages_batch,
|
||||
do_export_user,
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
from requests.exceptions import ConnectionError
|
||||
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.test_classes import ZulipTestCase
|
||||
from zerver.lib.test_helpers import MockPythonResponse
|
||||
|
|
|
@ -5,21 +5,18 @@ import sys
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.test import RequestFactory, TestCase
|
||||
from django.http import HttpRequest
|
||||
from django.test import TestCase
|
||||
from django.utils.log import AdminEmailHandler
|
||||
from functools import wraps
|
||||
from mock import MagicMock, patch
|
||||
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 zerver.lib.request import JsonableError
|
||||
from zerver.lib.types import ViewFuncT
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
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_exc_info = None # type: Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
import glob
|
||||
import os
|
||||
import re
|
||||
import email
|
||||
from datetime import timedelta
|
||||
from email.mime.text import MIMEText
|
||||
from email.utils import parseaddr
|
||||
from mock import MagicMock, patch, call
|
||||
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.core.management import call_command
|
||||
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.test_classes import ZulipTestCase
|
||||
from zerver.lib.test_helpers import stdout_suppressed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Any, Dict, Generator, Mapping, Union
|
||||
from typing import Any, Dict, Mapping, Union
|
||||
|
||||
import mock
|
||||
|
||||
|
@ -16,7 +16,6 @@ from zerver.lib.test_classes import (
|
|||
|
||||
from zerver.models import (
|
||||
get_stream_recipient,
|
||||
Recipient,
|
||||
Subscription,
|
||||
UserPresence,
|
||||
)
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
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.http import HttpResponse
|
||||
from django.test import TestCase, override_settings
|
||||
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.decorator import JsonableError
|
||||
from zerver.lib.test_runner import slow
|
||||
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
|
||||
|
||||
|
@ -96,11 +94,10 @@ from zerver.lib.url_encoding import near_message_url
|
|||
|
||||
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
|
||||
|
||||
import datetime
|
||||
import DNS
|
||||
import mock
|
||||
import time
|
||||
import ujson
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import time
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.test import override_settings
|
||||
from unittest.mock import Mock, patch
|
||||
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 zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.stream_topic import StreamTopicTarget
|
||||
|
||||
from zerver.models import (
|
||||
get_realm,
|
||||
get_stream,
|
||||
get_stream_recipient,
|
||||
get_user,
|
||||
Recipient,
|
||||
UserProfile,
|
||||
)
|
||||
|
||||
|
|
|
@ -4,18 +4,17 @@
|
|||
from django.db import connection
|
||||
from django.test import TestCase, override_settings
|
||||
from sqlalchemy.sql import (
|
||||
and_, select, column, table, literal, join, literal_column,
|
||||
and_, select, column, table,
|
||||
)
|
||||
from sqlalchemy.sql import compiler
|
||||
|
||||
from zerver.models import (
|
||||
Realm, Stream, Subscription, UserProfile, Attachment,
|
||||
get_display_recipient, get_personal_recipient, get_realm, get_stream, get_user,
|
||||
Reaction, UserMessage, get_stream_recipient, Message
|
||||
Realm, Subscription,
|
||||
get_display_recipient, get_personal_recipient, get_realm, get_stream,
|
||||
UserMessage, get_stream_recipient, Message
|
||||
)
|
||||
from zerver.lib.message import (
|
||||
MessageDict,
|
||||
get_first_visible_message_id,
|
||||
)
|
||||
from zerver.lib.narrow import (
|
||||
build_narrow_filter,
|
||||
|
@ -46,7 +45,7 @@ from zerver.views.messages import (
|
|||
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 os
|
||||
import re
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import datetime
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.contrib.auth.signals import user_logged_in
|
||||
from django.test import override_settings
|
||||
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import ujson
|
||||
|
@ -7,29 +5,24 @@ import ldap
|
|||
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.http import HttpResponse
|
||||
from django.test import override_settings
|
||||
from django_auth_ldap.config import LDAPSearch
|
||||
from email.utils import formataddr
|
||||
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, \
|
||||
enqueue_welcome_emails, relative_to_full_url
|
||||
from zerver.lib.actions import do_update_message, do_change_notification_settings
|
||||
from zerver.lib.message import access_message
|
||||
from zerver.lib.actions import do_change_notification_settings
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.send_email import FromAddress
|
||||
from zerver.lib.test_helpers import MockLDAP
|
||||
from zerver.models import (
|
||||
get_realm,
|
||||
get_stream,
|
||||
Recipient,
|
||||
UserMessage,
|
||||
UserProfile,
|
||||
ScheduledEmail
|
||||
)
|
||||
from zerver.lib.test_helpers import get_test_image_file
|
||||
|
||||
class TestFollowupEmails(ZulipTestCase):
|
||||
def test_day1_email_context(self) -> None:
|
||||
|
|
|
@ -5,10 +5,7 @@ import logging
|
|||
import mock
|
||||
import requests
|
||||
|
||||
from builtins import object
|
||||
from django.test import override_settings
|
||||
from requests import Response
|
||||
from typing import Any, Dict, Tuple, Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from zerver.lib.outgoing_webhook import (
|
||||
do_rest_call,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import timedelta
|
||||
from django.http import HttpResponse
|
||||
from django.test import override_settings
|
||||
from django.utils.timezone import now as timezone_now
|
||||
import mock
|
||||
|
||||
|
|
|
@ -5,28 +5,24 @@ import itertools
|
|||
import requests
|
||||
import mock
|
||||
from mock import call
|
||||
import time
|
||||
from typing import Any, Dict, List, Optional, Union, SupportsInt
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import base64
|
||||
import gcm
|
||||
import json
|
||||
import os
|
||||
import ujson
|
||||
import uuid
|
||||
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test import override_settings
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
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 analytics.lib.counts import CountStat, LoggingCountStat
|
||||
from analytics.models import InstallationCount, RealmCount
|
||||
from zerver.models import (
|
||||
PushDeviceToken,
|
||||
UserProfile,
|
||||
Message,
|
||||
UserMessage,
|
||||
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, \
|
||||
build_analytics_data, PushNotificationBouncerException
|
||||
from zerver.lib.request import JsonableError
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
)
|
||||
|
@ -877,7 +872,6 @@ class TestAPNs(PushNotificationTest):
|
|||
self.user_profile.id, device.token)
|
||||
|
||||
def test_http_retry_pipefail(self) -> None:
|
||||
import hyper
|
||||
with self.mock_apns() as mock_apns, \
|
||||
mock.patch('zerver.lib.push_notifications.logger') as mock_logging:
|
||||
mock_apns.get_notification_result.side_effect = itertools.chain(
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import mock
|
||||
import os
|
||||
from typing import Any, Dict
|
||||
import ujson
|
||||
|
||||
from django.test import override_settings
|
||||
from pika.exceptions import ConnectionClosed, AMQPConnectionError
|
||||
|
||||
from zerver.lib.queue import TornadoQueueClient, queue_json_publish, \
|
||||
get_queue_client, SimpleQueueClient
|
||||
get_queue_client
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
|
||||
class TestTornadoQueueClient(ZulipTestCase):
|
||||
|
|
|
@ -5,8 +5,7 @@ import ujson
|
|||
import smtplib
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test import override_settings
|
||||
from mock import patch, MagicMock
|
||||
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.request import JsonableError
|
||||
from zerver.lib.test_helpers import tornado_redirected_to_list, \
|
||||
get_test_image_file
|
||||
from zerver.lib.test_helpers import tornado_redirected_to_list
|
||||
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):
|
||||
def test_missing_emoji(self) -> None:
|
||||
|
|
|
@ -6,10 +6,7 @@ import mock
|
|||
from email.utils import parseaddr
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.conf import settings
|
||||
from mock import patch
|
||||
from typing import Any, Dict, List, Union, Mapping
|
||||
from typing import Any, Dict, List, Mapping
|
||||
|
||||
from zerver.lib.actions import (
|
||||
do_change_is_admin,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.utils import IntegrityError
|
||||
from typing import Optional
|
||||
|
||||
from zerver.lib.actions import do_change_is_admin, \
|
||||
do_change_realm_domain, do_create_realm, \
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
import mock
|
||||
|
||||
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_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
|
||||
|
||||
class RealmEmojiTest(ZulipTestCase):
|
||||
|
|
|
@ -10,7 +10,6 @@ from zerver.lib.utils import statsd
|
|||
|
||||
import mock
|
||||
import ujson
|
||||
import os
|
||||
|
||||
def fix_params(raw_params: Dict[str, Any]) -> Dict[str, str]:
|
||||
# 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 zerver.lib.test_classes import ZulipTestCase
|
||||
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
|
||||
from zerver.lib.retention import get_expired_messages, move_messages_to_archive
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import mock
|
||||
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.models import (
|
||||
get_realm,
|
||||
BotStorageData,
|
||||
UserProfile,
|
||||
Recipient,
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.sessions import (
|
|||
)
|
||||
|
||||
from zerver.models import (
|
||||
UserProfile, get_user_profile_by_id, get_realm, Realm
|
||||
get_realm, Realm
|
||||
)
|
||||
|
||||
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_helpers import MockLDAP
|
||||
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
|
||||
|
||||
class ChangeSettingsTest(ZulipTestCase):
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from email.utils import parseaddr
|
||||
import re
|
||||
|
||||
import django_otp
|
||||
from django.conf import settings
|
||||
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.utils.timezone import now as timezone_now
|
||||
from django.core.exceptions import ValidationError
|
||||
from two_factor.utils import default_device
|
||||
|
||||
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, \
|
||||
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 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.exceptions import CannotDeactivateLastUserError
|
||||
from zerver.lib.actions import get_default_streams_for_realm
|
||||
from zerver.lib.dev_ldap_directory import init_fakeldap
|
||||
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
|
||||
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.models import (
|
||||
get_realm, get_user, get_stream_recipient, get_realm_stream,
|
||||
PreregistrationUser, Realm, RealmDomain, Recipient, Message,
|
||||
PreregistrationUser, Realm, Recipient, Message,
|
||||
ScheduledEmail, UserProfile, UserMessage,
|
||||
Stream, Subscription, flush_per_request_caches
|
||||
)
|
||||
|
@ -41,7 +36,6 @@ from zerver.lib.actions import (
|
|||
set_default_streams,
|
||||
do_change_is_admin,
|
||||
get_stream,
|
||||
do_create_realm,
|
||||
do_create_default_stream_group,
|
||||
do_add_default_stream,
|
||||
)
|
||||
|
@ -53,7 +47,6 @@ from zerver.lib.actions import (
|
|||
do_set_realm_property,
|
||||
add_new_user_history,
|
||||
)
|
||||
from zerver.lib.avatar import avatar_url
|
||||
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
|
||||
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 (
|
||||
ZulipTestCase,
|
||||
)
|
||||
from zerver.lib.test_runner import slow
|
||||
from zerver.lib.sessions import get_session_dict_user
|
||||
from zerver.lib.name_restrictions import is_disposable_domain
|
||||
from zerver.context_processors import common_context
|
||||
|
||||
from collections import defaultdict
|
||||
import re
|
||||
import smtplib
|
||||
import ujson
|
||||
|
||||
from typing import Any, Dict, List, Optional, Set
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import urllib
|
||||
import os
|
||||
import pytz
|
||||
|
||||
class RedirectAndLogIntoSubdomainTestCase(ZulipTestCase):
|
||||
|
|
|
@ -5,9 +5,6 @@ from django.utils.timezone import now as timezone_now
|
|||
from zerver.data_import.slack import (
|
||||
rm_tree,
|
||||
get_slack_api_data,
|
||||
get_user_email,
|
||||
build_avatar_url,
|
||||
build_avatar,
|
||||
get_admin,
|
||||
get_user_timezone,
|
||||
users_to_zerver_userprofile,
|
||||
|
@ -18,7 +15,6 @@ from zerver.data_import.slack import (
|
|||
channel_message_to_zerver_message,
|
||||
convert_slack_workspace_messages,
|
||||
do_convert_data,
|
||||
process_avatars,
|
||||
process_message_files,
|
||||
AddedChannelsT,
|
||||
ZerverFieldsT,
|
||||
|
@ -36,9 +32,6 @@ from zerver.data_import.sequencer import (
|
|||
from zerver.lib.import_realm import (
|
||||
do_import_realm,
|
||||
)
|
||||
from zerver.lib.avatar_hash import (
|
||||
user_avatar_path_from_ids,
|
||||
)
|
||||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
)
|
||||
|
@ -51,16 +44,13 @@ from zerver.models import (
|
|||
RealmAuditLog,
|
||||
Recipient,
|
||||
)
|
||||
from zerver.lib import mdiff
|
||||
|
||||
import ujson
|
||||
import json
|
||||
import logging
|
||||
import shutil
|
||||
import requests
|
||||
import os
|
||||
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:
|
||||
if os.path.exists(path):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.conf import settings
|
||||
|
||||
from zerver.data_import.slack_message_conversion import (
|
||||
convert_to_zulip_markdown,
|
||||
get_user_full_name
|
||||
|
@ -13,7 +11,7 @@ from zerver.lib import mdiff
|
|||
import ujson
|
||||
|
||||
import os
|
||||
from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
class SlackMessageConversion(ZulipTestCase):
|
||||
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.models import (
|
||||
Client, UserProfile, UserActivity, get_realm, Recipient
|
||||
Client, UserProfile, UserActivity, get_realm,
|
||||
)
|
||||
|
||||
class UserSoftDeactivationTests(ZulipTestCase):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import mock
|
||||
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.models import Realm
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# -*- 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.core.exceptions import ValidationError
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.test import override_settings
|
||||
from django.utils.timezone import now as timezone_now
|
||||
|
||||
from zerver.lib import cache
|
||||
|
@ -42,7 +41,7 @@ from zerver.lib.test_runner 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,
|
||||
get_default_stream_groups, flush_per_request_caches, DefaultStreamGroup,
|
||||
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,
|
||||
gather_subscriptions_helper, bulk_add_subscriptions, bulk_remove_subscriptions,
|
||||
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,
|
||||
ensure_stream,
|
||||
do_deactivate_stream,
|
||||
|
@ -64,7 +63,6 @@ from zerver.lib.actions import (
|
|||
do_remove_default_stream_group,
|
||||
do_change_default_stream_group_description,
|
||||
do_change_default_stream_group_name,
|
||||
do_rename_stream,
|
||||
lookup_default_stream_groups,
|
||||
can_access_stream_user_ids,
|
||||
validate_user_access_to_subscribers_helper,
|
||||
|
@ -81,12 +79,10 @@ from zerver.lib.message import (
|
|||
)
|
||||
from zerver.lib.stream_recipient import StreamRecipientMap
|
||||
|
||||
from django.http import HttpResponse
|
||||
from datetime import timedelta
|
||||
import mock
|
||||
import random
|
||||
import ujson
|
||||
import urllib
|
||||
|
||||
class TestMiscStuff(ZulipTestCase):
|
||||
def test_empty_results(self) -> None:
|
||||
|
|
|
@ -5,9 +5,7 @@ import re
|
|||
from typing import Any, Dict, Iterable
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import override_settings
|
||||
from django.template import Template, Context
|
||||
from django.template.loader import get_template
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
|
@ -17,7 +15,6 @@ from zerver.lib.test_classes import (
|
|||
ZulipTestCase,
|
||||
)
|
||||
from zerver.lib.test_runner import slow
|
||||
from zerver.context_processors import common_context
|
||||
|
||||
|
||||
class get_form_value:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
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 (
|
||||
use_s3_backend,
|
||||
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.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
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
from dateutil import parser
|
||||
import pytz
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
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
|
||||
|
||||
class TutorialTests(ZulipTestCase):
|
||||
|
|
|
@ -10,7 +10,7 @@ from zerver.lib.test_helpers import tornado_redirected_to_list
|
|||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
)
|
||||
from zerver.models import get_realm, get_user, get_display_recipient
|
||||
from zerver.models import get_display_recipient
|
||||
|
||||
class TypingNotificationOperatorTest(ZulipTestCase):
|
||||
def test_missing_parameter(self) -> None:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-AA
|
||||
|
||||
from typing import Any, Dict, List, Mapping
|
||||
from typing import Any, List, Mapping
|
||||
|
||||
from django.db import connection
|
||||
from django.test import override_settings
|
||||
|
@ -10,8 +10,6 @@ from zerver.models import (
|
|||
get_stream,
|
||||
get_stream_recipient,
|
||||
get_user,
|
||||
Recipient,
|
||||
Stream,
|
||||
Subscription,
|
||||
UserMessage,
|
||||
UserProfile,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from unittest import skip
|
||||
from unittest.mock import patch
|
||||
|
||||
from zerver.lib.avatar import (
|
||||
|
@ -16,12 +15,10 @@ from zerver.lib.test_classes import ZulipTestCase, UploadSerializeMixin
|
|||
from zerver.lib.test_helpers import (
|
||||
avatar_disk_path,
|
||||
get_test_image_file,
|
||||
POSTRequestMock,
|
||||
use_s3_backend,
|
||||
create_s3_buckets,
|
||||
queries_captured,
|
||||
)
|
||||
from zerver.lib.test_runner import slow
|
||||
from zerver.lib.upload import sanitize_name, S3UploadBackend, \
|
||||
upload_message_file, upload_emoji_image, delete_message_image, LocalUploadBackend, \
|
||||
ZulipUploadBackend, MEDIUM_AVATAR_SIZE, resize_avatar, \
|
||||
|
@ -30,7 +27,7 @@ from zerver.lib.upload import sanitize_name, S3UploadBackend, \
|
|||
exif_rotate
|
||||
import zerver.lib.upload
|
||||
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, \
|
||||
validate_attachment_request
|
||||
from zerver.lib.actions import (
|
||||
|
@ -39,14 +36,12 @@ from zerver.lib.actions import (
|
|||
internal_send_private_message,
|
||||
)
|
||||
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.views.upload import upload_file_backend, serve_local
|
||||
from zerver.views.upload import upload_file_backend
|
||||
|
||||
import urllib
|
||||
from PIL import Image
|
||||
|
||||
from boto.s3.key import Key
|
||||
from io import StringIO
|
||||
import mock
|
||||
import os
|
||||
|
@ -54,15 +49,9 @@ import io
|
|||
import shutil
|
||||
import re
|
||||
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 sendfile import _get_sendfile
|
||||
|
||||
from typing import Any, Callable
|
||||
|
||||
def destroy_uploads() -> None:
|
||||
if os.path.exists(settings.LOCAL_UPLOADS_DIR):
|
||||
shutil.rmtree(settings.LOCAL_UPLOADS_DIR)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from typing import Any, List, Optional
|
||||
|
||||
import ujson
|
||||
import django
|
||||
import mock
|
||||
|
||||
from zerver.lib.actions import (
|
||||
|
@ -22,7 +19,7 @@ from zerver.lib.user_groups import (
|
|||
get_memberships_of_users,
|
||||
user_groups_in_realm_serialized,
|
||||
)
|
||||
from zerver.models import UserProfile, UserGroup, get_realm, Realm, \
|
||||
from zerver.models import UserGroup, get_realm, Realm, \
|
||||
UserGroupMembership
|
||||
|
||||
class UserGroupTestCase(ZulipTestCase):
|
||||
|
|
|
@ -3,29 +3,23 @@
|
|||
from typing import (Any, Dict, Iterable, List, Mapping,
|
||||
Optional, TypeVar, Union)
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.test import TestCase
|
||||
|
||||
from zerver.lib.test_helpers import (
|
||||
queries_captured, simulated_empty_cache,
|
||||
tornado_redirected_to_list, get_subscription,
|
||||
most_recent_message, make_client, avatar_disk_path,
|
||||
get_test_image_file
|
||||
most_recent_message,
|
||||
)
|
||||
from zerver.lib.test_classes import (
|
||||
ZulipTestCase,
|
||||
)
|
||||
from zerver.lib.test_runner import slow
|
||||
|
||||
from zerver.models import UserProfile, Recipient, \
|
||||
Realm, RealmDomain, UserActivity, UserHotspot, \
|
||||
get_user, get_realm, get_client, get_stream, get_stream_recipient, \
|
||||
get_source_profile, Message, get_context_for_message, \
|
||||
ScheduledEmail, check_valid_user_ids, get_user, \
|
||||
RealmDomain, UserHotspot, \
|
||||
get_user, get_realm, get_stream, get_stream_recipient, \
|
||||
get_source_profile, \
|
||||
ScheduledEmail, check_valid_user_ids, \
|
||||
get_user_by_id_in_realm_including_cross_realm, CustomProfileField
|
||||
|
||||
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.send_email import send_future_email
|
||||
from zerver.lib.actions import (
|
||||
|
@ -34,7 +28,6 @@ from zerver.lib.actions import (
|
|||
do_deactivate_user,
|
||||
do_reactivate_user,
|
||||
do_change_is_admin,
|
||||
do_change_is_guest,
|
||||
do_create_user,
|
||||
)
|
||||
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, \
|
||||
get_accounts_for_email
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import datetime
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import ujson
|
||||
|
||||
K = TypeVar('K')
|
||||
|
|
|
@ -3,7 +3,7 @@ import ujson
|
|||
|
||||
from django.http import HttpResponse
|
||||
from mock import patch
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.users import get_api_key
|
||||
|
|
Loading…
Reference in New Issue