models: Extract zerver.models.realms.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-12-14 17:14:24 -08:00 committed by Tim Abbott
parent 7001a0dfc0
commit cd96193768
119 changed files with 1219 additions and 1182 deletions

View File

@ -10,7 +10,8 @@ from analytics.models import FillState, RealmCount, StreamCount, UserCount
from analytics.views.stats import rewrite_client_arrays, sort_by_totals, sort_client_labels from analytics.views.stats import rewrite_client_arrays, sort_by_totals, sort_client_labels
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, datetime_to_timestamp from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, datetime_to_timestamp
from zerver.models import Client, get_realm from zerver.models import Client
from zerver.models.realms import get_realm
class TestStatsEndpoint(ZulipTestCase): class TestStatsEndpoint(ZulipTestCase):

View File

@ -23,16 +23,8 @@ from zerver.actions.realm_settings import do_change_realm_org_type, do_send_real
from zerver.actions.user_settings import do_change_user_setting from zerver.actions.user_settings import do_change_user_setting
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
from zerver.models import ( from zerver.models import MultiuseInvite, PreregistrationUser, Realm, UserMessage, UserProfile
MultiuseInvite, from zerver.models.realms import OrgTypeEnum, get_org_type_display_name, get_realm
OrgTypeEnum,
PreregistrationUser,
Realm,
UserMessage,
UserProfile,
get_org_type_display_name,
get_realm,
)
from zilencer.lib.remote_counts import MissingDataError from zilencer.lib.remote_counts import MissingDataError
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -25,7 +25,8 @@ from analytics.views.activity_common import (
from analytics.views.support import get_plan_type_string from analytics.views.support import get_plan_type_string
from zerver.decorator import require_server_admin from zerver.decorator import require_server_admin
from zerver.lib.request import has_request_variables from zerver.lib.request import has_request_variables
from zerver.models import Realm, get_org_type_display_name from zerver.models import Realm
from zerver.models.realms import get_org_type_display_name
if settings.BILLING_ENABLED: if settings.BILLING_ENABLED:
from corporate.lib.analytics import ( from corporate.lib.analytics import (

View File

@ -36,7 +36,8 @@ from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id from zerver.lib.streams import access_stream_by_id
from zerver.lib.timestamp import convert_to_UTC from zerver.lib.timestamp import convert_to_UTC
from zerver.lib.validator import to_non_negative_int from zerver.lib.validator import to_non_negative_int
from zerver.models import Client, Realm, Stream, UserProfile, get_realm from zerver.models import Client, Realm, Stream, UserProfile
from zerver.models.realms import get_realm
if settings.ZILENCER_ENABLED: if settings.ZILENCER_ENABLED:
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, RemoteZulipServer from zilencer.models import RemoteInstallationCount, RemoteRealmCount, RemoteZulipServer

View File

@ -40,9 +40,8 @@ from zerver.models import (
Realm, Realm,
RealmReactivationStatus, RealmReactivationStatus,
UserProfile, UserProfile,
get_org_type_display_name,
get_realm,
) )
from zerver.models.realms import get_org_type_display_name, get_realm
from zerver.models.users import get_user_profile_by_id from zerver.models.users import get_user_profile_by_id
from zerver.views.invite import get_invitee_emails_set from zerver.views.invite import get_invitee_emails_set

View File

@ -50,7 +50,8 @@ from zerver.lib.send_email import (
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.lib.url_encoding import append_url_query_string from zerver.lib.url_encoding import append_url_query_string
from zerver.lib.utils import assert_is_not_none from zerver.lib.utils import assert_is_not_none
from zerver.models import Realm, RealmAuditLog, UserProfile, get_org_type_display_name, get_realm from zerver.models import Realm, RealmAuditLog, UserProfile
from zerver.models.realms import get_org_type_display_name, get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
from zilencer.lib.remote_counts import MissingDataError from zilencer.lib.remote_counts import MissingDataError
from zilencer.models import ( from zilencer.models import (

View File

@ -14,7 +14,8 @@ from corporate.models import (
ZulipSponsorshipRequest, ZulipSponsorshipRequest,
get_current_plan_by_customer, get_current_plan_by_customer,
) )
from zerver.models import Realm, get_org_type_display_name, get_realm from zerver.models import Realm
from zerver.models.realms import get_org_type_display_name, get_realm
from zilencer.lib.remote_counts import MissingDataError from zilencer.lib.remote_counts import MissingDataError

View File

@ -102,7 +102,8 @@ from zerver.lib.remote_server import send_server_data_to_push_bouncer
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.lib.utils import assert_is_not_none from zerver.lib.utils import assert_is_not_none
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile, get_realm from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
from zilencer.lib.remote_counts import MissingDataError from zilencer.lib.remote_counts import MissingDataError
from zilencer.models import ( from zilencer.models import (

View File

@ -35,7 +35,7 @@ organization in Zulip). The following files are involved in the process:
**Backend** **Backend**
- `zerver/models/__init__.py`: Defines the database model. - `zerver/models/realms.py`: Defines the database model.
- `zerver/views/realm.py`: The view function that implements the API endpoint - `zerver/views/realm.py`: The view function that implements the API endpoint
for editing realm objects. for editing realm objects.
- `zerver/actions/realm_settings.py`: Contains code for updating and interacting with the database. - `zerver/actions/realm_settings.py`: Contains code for updating and interacting with the database.
@ -73,7 +73,7 @@ organization in Zulip). The following files are involved in the process:
### Adding a field to the database ### Adding a field to the database
**Update the model:** The server accesses the underlying database in **Update the model:** The server accesses the underlying database in
`zerver/models/__init__.py`. Add a new field in the appropriate class. `zerver/models/realms.py`. Add a new field in the appropriate class.
**Create and run the migration:** To create and apply a migration, run the **Create and run the migration:** To create and apply a migration, run the
following commands: following commands:
@ -185,10 +185,10 @@ task of requiring messages to have a topic, you can [view this commit](https://g
First, update the database and model to store the new setting. Add a new First, update the database and model to store the new setting. Add a new
boolean field, `mandatory_topics`, to the Realm model in boolean field, `mandatory_topics`, to the Realm model in
`zerver/models/__init__.py`. `zerver/models/realms.py`.
```diff ```diff
# zerver/models/__init__.py # zerver/models/realms.py
class Realm(models.Model): class Realm(models.Model):
# ... # ...
@ -205,7 +205,7 @@ is the field's type. Add the new field to the `property_types`
dictionary. dictionary.
```diff ```diff
# zerver/models/__init__.py # zerver/models/realms.py
class Realm(models.Model) class Realm(models.Model)
# ... # ...

View File

@ -66,7 +66,7 @@ django.setup()
from django.conf import settings from django.conf import settings
from zerver.models import get_realm from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
states = { states = {

View File

@ -50,7 +50,8 @@ from zerver.lib.storage import static_path
from zerver.lib.streams import create_stream_if_needed from zerver.lib.streams import create_stream_if_needed
from zerver.lib.upload import upload_avatar_image from zerver.lib.upload import upload_avatar_image
from zerver.lib.webhooks.common import get_fixture_http_headers from zerver.lib.webhooks.common import get_fixture_http_headers
from zerver.models import Message, UserProfile, get_realm from zerver.models import Message, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_user_by_delivery_email from zerver.models.users import get_user_by_delivery_email

View File

@ -50,7 +50,7 @@ rules:
- pattern-not: from zerver.models import filter_pattern_validator - pattern-not: from zerver.models import filter_pattern_validator
- pattern-not: from zerver.models import url_template_validator - pattern-not: from zerver.models import url_template_validator
- pattern-not: from zerver.models import generate_email_token_for_stream - pattern-not: from zerver.models import generate_email_token_for_stream
- pattern-not: from zerver.models import generate_realm_uuid_owner_secret - pattern-not: from zerver.models.realms import generate_realm_uuid_owner_secret
- pattern-either: - pattern-either:
- pattern: from zerver import $X - pattern: from zerver import $X
- pattern: from analytics import $X - pattern: from analytics import $X

View File

@ -36,7 +36,7 @@ with test_server_running(
from zerver.actions.users import change_user_is_active from zerver.actions.users import change_user_is_active
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
from zerver.lib.users import get_api_key from zerver.lib.users import get_api_key
from zerver.models import get_realm from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
from zerver.openapi.javascript_examples import test_js_bindings from zerver.openapi.javascript_examples import test_js_bindings
from zerver.openapi.python_examples import ( from zerver.openapi.python_examples import (

View File

@ -31,9 +31,8 @@ from zerver.models import (
RealmUserDefault, RealmUserDefault,
Stream, Stream,
UserProfile, UserProfile,
get_org_type_display_name,
get_realm,
) )
from zerver.models.realms import get_org_type_display_name, get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
from zproject.backends import all_implemented_backend_names from zproject.backends import all_implemented_backend_names

View File

@ -4,14 +4,8 @@ from django.db import transaction
from django.utils.timezone import now as timezone_now from django.utils.timezone import now as timezone_now
from zerver.actions.realm_settings import do_set_realm_property from zerver.actions.realm_settings import do_set_realm_property
from zerver.models import ( from zerver.models import Realm, RealmAuditLog, RealmDomain, UserProfile
Realm, from zerver.models.realms import RealmDomainDict, get_realm_domains
RealmAuditLog,
RealmDomain,
RealmDomainDict,
UserProfile,
get_realm_domains,
)
from zerver.models.users import active_user_ids from zerver.models.users import active_user_ids
from zerver.tornado.django_api import send_event_on_commit from zerver.tornado.django_api import send_event_on_commit

View File

@ -33,9 +33,9 @@ from zerver.models import (
Subscription, Subscription,
UserGroup, UserGroup,
UserProfile, UserProfile,
get_realm,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import active_user_ids from zerver.models.users import active_user_ids
from zerver.tornado.django_api import send_event, send_event_on_commit from zerver.tornado.django_api import send_event, send_event_on_commit

View File

@ -42,8 +42,8 @@ from zerver.models import (
UserGroupMembership, UserGroupMembership,
UserProfile, UserProfile,
get_bot_services, get_bot_services,
get_fake_email_domain,
) )
from zerver.models.realms import get_fake_email_domain
from zerver.models.users import ( from zerver.models.users import (
active_non_guest_user_ids, active_non_guest_user_ids,
active_user_ids, active_user_ids,

View File

@ -20,7 +20,8 @@ from zerver.lib.realm_icon import get_realm_icon_url
from zerver.lib.request import RequestNotes from zerver.lib.request import RequestNotes
from zerver.lib.send_email import FromAddress from zerver.lib.send_email import FromAddress
from zerver.lib.subdomains import get_subdomain, is_root_domain_available from zerver.lib.subdomains import get_subdomain, is_root_domain_available
from zerver.models import Realm, UserProfile, get_realm from zerver.models import Realm, UserProfile
from zerver.models.realms import get_realm
from zproject.backends import ( from zproject.backends import (
AUTH_BACKEND_NAME_MAP, AUTH_BACKEND_NAME_MAP,
auth_enabled_helper, auth_enabled_helper,

View File

@ -35,12 +35,11 @@ from zerver.lib.send_email import FromAddress, send_email
from zerver.lib.soft_deactivation import queue_soft_reactivation from zerver.lib.soft_deactivation import queue_soft_reactivation
from zerver.lib.subdomains import get_subdomain, is_root_domain_available from zerver.lib.subdomains import get_subdomain, is_root_domain_available
from zerver.lib.users import check_full_name from zerver.lib.users import check_full_name
from zerver.models import ( from zerver.models import Realm, UserProfile
from zerver.models.realms import (
DisposableEmailError, DisposableEmailError,
DomainNotAllowedForRealmError, DomainNotAllowedForRealmError,
EmailContainsPlusError, EmailContainsPlusError,
Realm,
UserProfile,
get_realm, get_realm,
) )
from zerver.models.users import get_user_by_delivery_email, is_cross_realm_bot_email from zerver.models.users import get_user_by_delivery_email, is_cross_realm_bot_email

View File

@ -591,7 +591,7 @@ def flush_muting_users_cache(*, instance: "MutedUser", **kwargs: object) -> None
cache_delete(get_muting_users_cache_key(mute_object.muted_user_id)) cache_delete(get_muting_users_cache_key(mute_object.muted_user_id))
# Called by models/__init__.py to flush various caches whenever we save # Called by models/realms.py to flush various caches whenever we save
# a Realm object. The main tricky thing here is that Realm info is # a Realm object. The main tricky thing here is that Realm info is
# generally cached indirectly through user_profile objects. # generally cached indirectly through user_profile objects.
def flush_realm( def flush_realm(

View File

@ -18,8 +18,8 @@ from zerver.models import (
Subscription, Subscription,
UserBaseSettings, UserBaseSettings,
UserProfile, UserProfile,
get_fake_email_domain,
) )
from zerver.models.realms import get_fake_email_domain
def copy_default_settings( def copy_default_settings(

View File

@ -8,12 +8,11 @@ from django.utils.translation import gettext as _
from zerver.lib.name_restrictions import is_disposable_domain from zerver.lib.name_restrictions import is_disposable_domain
# TODO: Move DisposableEmailError, etc. into here. # TODO: Move DisposableEmailError, etc. into here.
from zerver.models import ( from zerver.models import Realm, RealmDomain
from zerver.models.realms import (
DisposableEmailError, DisposableEmailError,
DomainNotAllowedForRealmError, DomainNotAllowedForRealmError,
EmailContainsPlusError, EmailContainsPlusError,
Realm,
RealmDomain,
) )
from zerver.models.users import get_users_by_delivery_email, is_cross_realm_bot_email from zerver.models.users import get_users_by_delivery_email, is_cross_realm_bot_email

View File

@ -82,11 +82,11 @@ from zerver.models import (
custom_profile_fields_for_realm, custom_profile_fields_for_realm,
get_all_custom_emoji_for_realm, get_all_custom_emoji_for_realm,
get_default_stream_groups, get_default_stream_groups,
get_realm_domains,
get_realm_playgrounds, get_realm_playgrounds,
linkifiers_for_realm, linkifiers_for_realm,
) )
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
from zerver.models.realms import get_realm_domains
from zerver.tornado.django_api import get_user_events, request_event_queue from zerver.tornado.django_api import get_user_events, request_event_queue
from zproject.backends import email_auth_enabled, password_auth_enabled from zproject.backends import email_auth_enabled, password_auth_enabled

View File

@ -69,8 +69,8 @@ from zerver.models import (
UserProfile, UserProfile,
UserStatus, UserStatus,
UserTopic, UserTopic,
get_realm,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user_profile_by_id from zerver.models.users import get_system_bot, get_user_profile_by_id
# Custom mypy types follow: # Custom mypy types follow:

View File

@ -77,9 +77,9 @@ from zerver.models import (
UserStatus, UserStatus,
UserTopic, UserTopic,
get_huddle_hash, get_huddle_hash,
get_realm,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user_profile_by_id from zerver.models.users import get_system_bot, get_user_profile_by_id
realm_tables = [ realm_tables = [

View File

@ -75,11 +75,11 @@ from zerver.models import (
UserProfile, UserProfile,
UserTopic, UserTopic,
get_display_recipient_by_id, get_display_recipient_by_id,
get_fake_email_domain,
get_usermessage_by_message_id, get_usermessage_by_message_id,
query_for_ids, query_for_ids,
) )
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
from zerver.models.realms import get_fake_email_domain
class MessageDetailsDict(TypedDict, total=False): class MessageDetailsDict(TypedDict, total=False):

View File

@ -65,8 +65,8 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_display_recipient, get_display_recipient,
get_fake_email_domain,
) )
from zerver.models.realms import get_fake_email_domain
from zerver.models.users import get_user_profile_by_id from zerver.models.users import get_user_profile_by_id
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -22,7 +22,8 @@ from zerver.lib.exceptions import (
) )
from zerver.lib.outgoing_http import OutgoingSession from zerver.lib.outgoing_http import OutgoingSession
from zerver.lib.queue import queue_event_on_commit from zerver.lib.queue import queue_event_on_commit
from zerver.models import OrgTypeEnum, Realm, RealmAuditLog from zerver.models import Realm, RealmAuditLog
from zerver.models.realms import OrgTypeEnum
class PushBouncerSession(OutgoingSession): class PushBouncerSession(OutgoingSession):

View File

@ -15,11 +15,11 @@ from zerver.actions.users import do_change_user_role, do_deactivate_user
from zerver.lib.email_validation import email_allowed_for_realm, validate_email_not_already_in_realm from zerver.lib.email_validation import email_allowed_for_realm, validate_email_not_already_in_realm
from zerver.lib.request import RequestNotes from zerver.lib.request import RequestNotes
from zerver.lib.subdomains import get_subdomain from zerver.lib.subdomains import get_subdomain
from zerver.models import ( from zerver.models import UserProfile
from zerver.models.realms import (
DisposableEmailError, DisposableEmailError,
DomainNotAllowedForRealmError, DomainNotAllowedForRealmError,
EmailContainsPlusError, EmailContainsPlusError,
UserProfile,
) )

View File

@ -107,12 +107,11 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
UserStatus, UserStatus,
clear_supported_auth_backends_cache,
get_realm,
get_realm_stream, get_realm_stream,
get_stream, get_stream,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import clear_supported_auth_backends_cache, get_realm
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
from zerver.openapi.openapi import validate_against_openapi_schema, validate_request from zerver.openapi.openapi import validate_against_openapi_schema, validate_request
from zerver.tornado.event_queue import clear_client_event_queues_for_testing from zerver.tornado.event_queue import clear_client_event_queues_for_testing

View File

@ -60,9 +60,9 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_client, get_client,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.tornado.handlers import AsyncDjangoHandler, allocate_handler_id from zerver.tornado.handlers import AsyncDjangoHandler, allocate_handler_id
from zilencer.models import RemoteZulipServer from zilencer.models import RemoteZulipServer
from zproject.backends import ExternalAuthDataDict, ExternalAuthResult from zproject.backends import ExternalAuthDataDict, ExternalAuthResult

View File

@ -36,9 +36,9 @@ from zerver.models import (
Subscription, Subscription,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_fake_email_domain,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_fake_email_domain
from zerver.models.users import ( from zerver.models.users import (
active_non_guest_user_ids, active_non_guest_user_ids,
active_user_ids, active_user_ids,

View File

@ -9,7 +9,8 @@ from typing_extensions import override
from zerver.lib.domains import validate_domain from zerver.lib.domains import validate_domain
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zerver.models import RealmDomain, get_realm_domains from zerver.models import RealmDomain
from zerver.models.realms import get_realm_domains
class Command(ZulipBaseCommand): class Command(ZulipBaseCommand):

View File

@ -13,7 +13,8 @@ from typing_extensions import override
from zerver.lib.email_mirror import mirror_email_message from zerver.lib.email_mirror import mirror_email_message
from zerver.lib.email_mirror_helpers import encode_email_address from zerver.lib.email_mirror_helpers import encode_email_address
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zerver.models import Realm, get_realm, get_stream from zerver.models import Realm, get_stream
from zerver.models.realms import get_realm
# This command loads an email from a specified file and sends it # This command loads an email from a specified file and sends it
# to the email mirror. Simple emails can be passed in a JSON file, # to the email mirror. Simple emails can be passed in a JSON file,

View File

@ -9,7 +9,7 @@ from typing_extensions import override
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zerver.lib.webhooks.common import standardize_headers from zerver.lib.webhooks.common import standardize_headers
from zerver.models import get_realm from zerver.models.realms import get_realm
class Command(ZulipBaseCommand): class Command(ZulipBaseCommand):

View File

@ -42,7 +42,8 @@ from zerver.lib.response import (
) )
from zerver.lib.subdomains import get_subdomain from zerver.lib.subdomains import get_subdomain
from zerver.lib.user_agent import parse_user_agent from zerver.lib.user_agent import parse_user_agent
from zerver.models import Realm, get_realm from zerver.models import Realm
from zerver.models.realms import get_realm
ParamT = ParamSpec("ParamT") ParamT = ParamSpec("ParamT")
logger = logging.getLogger("zulip.requests") logger = logging.getLogger("zulip.requests")

View File

@ -4,7 +4,7 @@ import uuid
from django.db import migrations, models from django.db import migrations, models
from zerver.models import generate_realm_uuid_owner_secret from zerver.models.realms import generate_realm_uuid_owner_secret
class Migration(migrations.Migration): class Migration(migrations.Migration):

File diff suppressed because it is too large Load Diff

1019
zerver/models/realms.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1060,7 +1060,8 @@ def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:
def get_source_profile(email: str, realm_id: int) -> Optional[UserProfile]: def get_source_profile(email: str, realm_id: int) -> Optional[UserProfile]:
from zerver.models import Realm, get_realm_by_id from zerver.models import Realm
from zerver.models.realms import get_realm_by_id
try: try:
return get_user_by_delivery_email(email, get_realm_by_id(realm_id)) return get_user_by_delivery_email(email, get_realm_by_id(realm_id))

View File

@ -20,7 +20,8 @@ from zerver.lib.initial_password import initial_password
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.upload import upload_message_attachment from zerver.lib.upload import upload_message_attachment
from zerver.lib.users import get_api_key from zerver.lib.users import get_api_key
from zerver.models import Client, Message, UserGroup, UserPresence, get_realm from zerver.models import Client, Message, UserGroup, UserPresence
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {} GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {}

View File

@ -22,7 +22,7 @@ from typing import Any, Callable, Dict, List, Set, TypeVar
from typing_extensions import ParamSpec from typing_extensions import ParamSpec
from zulip import Client from zulip import Client
from zerver.models import get_realm from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
from zerver.openapi.openapi import validate_against_openapi_schema from zerver.openapi.openapi import validate_against_openapi_schema

View File

@ -16,7 +16,7 @@ import markdown
from django.conf import settings from django.conf import settings
from zulip import Client from zulip import Client
from zerver.models import get_realm from zerver.models.realms import get_realm
from zerver.openapi import markdown_extension from zerver.openapi import markdown_extension
from zerver.openapi.curl_param_value_generators import ( from zerver.openapi.curl_param_value_generators import (
AUTHENTICATION_LINE, AUTHENTICATION_LINE,

View File

@ -77,20 +77,18 @@ from zerver.models import (
Message, Message,
Realm, Realm,
RealmAuditLog, RealmAuditLog,
RealmDomainDict,
RealmPlayground, RealmPlayground,
Recipient, Recipient,
Subscription, Subscription,
UserGroup, UserGroup,
UserProfile, UserProfile,
get_all_custom_emoji_for_realm, get_all_custom_emoji_for_realm,
get_realm,
get_realm_domains,
get_realm_playgrounds, get_realm_playgrounds,
get_stream, get_stream,
linkifiers_for_realm, linkifiers_for_realm,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import RealmDomainDict, get_realm, get_realm_domains
class TestRealmAuditLog(ZulipTestCase): class TestRealmAuditLog(ZulipTestCase):

View File

@ -116,9 +116,8 @@ from zerver.models import (
Stream, Stream,
UserGroup, UserGroup,
UserProfile, UserProfile,
clear_supported_auth_backends_cache,
get_realm,
) )
from zerver.models.realms import clear_supported_auth_backends_cache, get_realm
from zerver.models.users import PasswordTooWeakError, get_user_by_delivery_email from zerver.models.users import PasswordTooWeakError, get_user_by_delivery_email
from zerver.signals import JUST_CREATED_THRESHOLD from zerver.signals import JUST_CREATED_THRESHOLD
from zerver.views.auth import log_into_subdomain, maybe_send_to_registration from zerver.views.auth import log_into_subdomain, maybe_send_to_registration

View File

@ -24,9 +24,9 @@ from zerver.models import (
Subscription, Subscription,
UserProfile, UserProfile,
get_bot_services, get_bot_services,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_user, is_cross_realm_bot_email from zerver.models.users import get_user, is_cross_realm_bot_email

View File

@ -21,7 +21,8 @@ from zerver.lib.cache import (
validate_cache_key, validate_cache_key,
) )
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import UserProfile, get_realm from zerver.models import UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user, get_user_profile_by_id from zerver.models.users import get_system_bot, get_user, get_user_profile_by_id

View File

@ -20,8 +20,8 @@ from zerver.models import (
CustomProfileFieldValue, CustomProfileFieldValue,
UserProfile, UserProfile,
custom_profile_fields_for_realm, custom_profile_fields_for_realm,
get_realm,
) )
from zerver.models.realms import get_realm
class CustomProfileFieldTestCase(ZulipTestCase): class CustomProfileFieldTestCase(ZulipTestCase):

View File

@ -52,7 +52,8 @@ from zerver.lib.user_agent import parse_user_agent
from zerver.lib.users import get_api_key from zerver.lib.users import get_api_key
from zerver.lib.utils import generate_api_key, has_api_key_format from zerver.lib.utils import generate_api_key, has_api_key_format
from zerver.middleware import LogRequests, parse_client from zerver.middleware import LogRequests, parse_client
from zerver.models import Client, Realm, UserProfile, clear_client_cache, get_realm from zerver.models import Client, Realm, UserProfile, clear_client_cache
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
if settings.ZILENCER_ENABLED: if settings.ZILENCER_ENABLED:

View File

@ -33,9 +33,9 @@ from zerver.models import (
Stream, Stream,
UserActivityInterval, UserActivityInterval,
UserProfile, UserProfile,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
class TestDigestEmailMessages(ZulipTestCase): class TestDigestEmailMessages(ZulipTestCase):

View File

@ -14,7 +14,8 @@ from zerver.context_processors import get_apps_page_url
from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import HostRequestMock from zerver.lib.test_helpers import HostRequestMock
from zerver.models import Realm, get_realm from zerver.models import Realm
from zerver.models.realms import get_realm
from zerver.views.documentation import add_api_url_context from zerver.views.documentation import add_api_url_context
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -18,7 +18,8 @@ from zerver.actions.realm_settings import do_deactivate_realm, do_set_realm_prop
from zerver.actions.user_settings import do_change_user_setting, do_start_email_change_process from zerver.actions.user_settings import do_change_user_setting, do_start_email_change_process
from zerver.actions.users import do_deactivate_user from zerver.actions.users import do_deactivate_user
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import EmailChangeStatus, UserProfile, get_realm from zerver.models import EmailChangeStatus, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_user, get_user_by_delivery_email, get_user_profile_by_id from zerver.models.users import get_user, get_user_by_delivery_email, get_user_profile_by_id

View File

@ -37,7 +37,8 @@ from zerver.lib.send_email import FromAddress
from zerver.lib.streams import ensure_stream from zerver.lib.streams import ensure_stream
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publish, most_recent_message, most_recent_usermessage from zerver.lib.test_helpers import mock_queue_publish, most_recent_message, most_recent_usermessage
from zerver.models import Attachment, Recipient, Stream, UserProfile, get_realm, get_stream from zerver.models import Attachment, Recipient, Stream, UserProfile, get_stream
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
from zerver.worker.queue_processors import MirrorWorker from zerver.worker.queue_processors import MirrorWorker

View File

@ -22,7 +22,8 @@ from zerver.lib.send_email import (
send_custom_server_email, send_custom_server_email,
) )
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Realm, ScheduledEmail, UserProfile, get_realm from zerver.models import Realm, ScheduledEmail, UserProfile
from zerver.models.realms import get_realm
from zilencer.models import RemoteZulipServer from zilencer.models import RemoteZulipServer

View File

@ -5,7 +5,8 @@ from typing_extensions import override
from zerver.lib.bot_lib import EmbeddedBotQuitError from zerver.lib.bot_lib import EmbeddedBotQuitError
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import UserProfile, get_display_recipient, get_realm, get_service_profile from zerver.models import UserProfile, get_display_recipient, get_service_profile
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user

View File

@ -34,9 +34,9 @@ from zerver.models import (
UserPresence, UserPresence,
UserProfile, UserProfile,
get_client, get_client,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
from zerver.tornado.event_queue import ( from zerver.tornado.event_queue import (
allocate_client_descriptor, allocate_client_descriptor,

View File

@ -11,7 +11,8 @@ from zerver.lib.streams import access_stream_for_send_message
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_message from zerver.lib.test_helpers import most_recent_message
from zerver.lib.users import is_administrator_role from zerver.lib.users import is_administrator_role
from zerver.models import UserProfile, UserStatus, get_realm, get_stream from zerver.models import UserProfile, UserStatus, get_stream
from zerver.models.realms import get_realm
from zerver.models.users import get_user_by_delivery_email from zerver.models.users import get_user_by_delivery_email

View File

@ -10,7 +10,8 @@ import time_machine
from zerver.data_import.gitter import do_convert_data, get_usermentions from zerver.data_import.gitter import do_convert_data, get_usermentions
from zerver.lib.import_realm import do_import_realm from zerver.lib.import_realm import do_import_realm
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, UserProfile, get_realm from zerver.models import Message, UserProfile
from zerver.models.realms import get_realm
from zproject.backends import ( from zproject.backends import (
AUTH_BACKEND_NAME_MAP, AUTH_BACKEND_NAME_MAP,
GitHubAuthBackend, GitHubAuthBackend,

View File

@ -24,15 +24,8 @@ from zerver.lib.soft_deactivation import do_soft_deactivate_users
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import get_user_messages, queries_captured from zerver.lib.test_helpers import get_user_messages, queries_captured
from zerver.lib.timestamp import datetime_to_timestamp from zerver.lib.timestamp import datetime_to_timestamp
from zerver.models import ( from zerver.models import DefaultStream, Draft, Realm, UserActivity, UserProfile, get_stream
DefaultStream, from zerver.models.realms import get_realm
Draft,
Realm,
UserActivity,
UserProfile,
get_realm,
get_stream,
)
from zerver.models.users import get_system_bot, get_user from zerver.models.users import get_system_bot, get_user
from zerver.worker.queue_processors import UserActivityWorker from zerver.worker.queue_processors import UserActivityWorker

View File

@ -10,7 +10,8 @@ from zerver.lib.hotspots import (
get_next_onboarding_steps, get_next_onboarding_steps,
) )
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import OnboardingStep, UserProfile, get_realm from zerver.models import OnboardingStep, UserProfile
from zerver.models.realms import get_realm
# 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

View File

@ -86,10 +86,10 @@ from zerver.models import (
get_active_streams, get_active_streams,
get_client, get_client,
get_huddle_hash, get_huddle_hash,
get_realm,
get_stream, get_stream,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user_by_delivery_email from zerver.models.users import get_system_bot, get_user_by_delivery_email

View File

@ -4,7 +4,8 @@ import orjson
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, Stream, get_realm from zerver.models import Message, Stream
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user

View File

@ -63,10 +63,10 @@ from zerver.models import (
UserGroup, UserGroup,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_realm,
get_stream, get_stream,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import get_user_by_delivery_email from zerver.models.users import get_user_by_delivery_email
from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES, get_invitee_emails_set from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES, get_invitee_emails_set
from zerver.views.registration import accounts_home from zerver.views.registration import accounts_home

View File

@ -20,7 +20,8 @@ from zerver.actions.reactions import do_add_reaction
from zerver.lib.management import ZulipBaseCommand, check_config from zerver.lib.management import ZulipBaseCommand, check_config
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_message, stdout_suppressed from zerver.lib.test_helpers import most_recent_message, stdout_suppressed
from zerver.models import Message, Reaction, Realm, Recipient, UserProfile, get_realm, get_stream from zerver.models import Message, Reaction, Realm, Recipient, UserProfile, get_stream
from zerver.models.realms import get_realm
from zerver.models.users import get_user_profile_by_email from zerver.models.users import get_user_profile_by_email

View File

@ -68,11 +68,11 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_client, get_client,
get_realm,
get_stream, get_stream,
linkifiers_for_realm, linkifiers_for_realm,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
class SimulatedFencedBlockPreprocessor(FencedBlockPreprocessor): class SimulatedFencedBlockPreprocessor(FencedBlockPreprocessor):

View File

@ -28,7 +28,8 @@ from zerver.data_import.user_handler import UserHandler
from zerver.lib.emoji import name_to_codepoint from zerver.lib.emoji import name_to_codepoint
from zerver.lib.import_realm import do_import_realm from zerver.lib.import_realm import do_import_realm
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm from zerver.models import Message, Reaction, Recipient, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user

View File

@ -20,9 +20,9 @@ from zerver.models import (
Stream, Stream,
UserProfile, UserProfile,
get_display_recipient, get_display_recipient,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
class MessageDictTest(ZulipTestCase): class MessageDictTest(ZulipTestCase):

View File

@ -38,11 +38,11 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
UserTopic, UserTopic,
get_realm,
get_stream, get_stream,
) )
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -58,9 +58,9 @@ from zerver.models import (
UserProfile, UserProfile,
UserTopic, UserTopic,
get_display_recipient, get_display_recipient,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.views.message_fetch import get_messages_backend from zerver.views.message_fetch import get_messages_backend
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -33,9 +33,9 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
UserTopic, UserTopic,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -33,9 +33,9 @@ from zerver.models import (
UserProfile, UserProfile,
UserTopic, UserTopic,
get_name_keyed_dict_for_active_realm_emoji, get_name_keyed_dict_for_active_realm_emoji,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
class TestMessageNotificationEmails(ZulipTestCase): class TestMessageNotificationEmails(ZulipTestCase):

View File

@ -57,11 +57,11 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_or_create_huddle, get_or_create_huddle,
get_realm,
get_stream, get_stream,
) )
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user from zerver.models.users import get_system_bot, get_user
from zerver.views.message_send import InvalidMirrorInputError from zerver.views.message_send import InvalidMirrorInputError

View File

@ -6,7 +6,8 @@ from zerver.actions.streams import do_change_stream_permission
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import timeout_mock from zerver.lib.test_helpers import timeout_mock
from zerver.lib.timeout import TimeoutExpiredError from zerver.lib.timeout import TimeoutExpiredError
from zerver.models import Message, UserMessage, get_client, get_realm, get_stream from zerver.models import Message, UserMessage, get_client, get_stream
from zerver.models.realms import get_realm
class TopicHistoryTest(ZulipTestCase): class TopicHistoryTest(ZulipTestCase):

View File

@ -11,7 +11,7 @@ from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import HostRequestMock from zerver.lib.test_helpers import HostRequestMock
from zerver.lib.utils import assert_is_not_none from zerver.lib.utils import assert_is_not_none
from zerver.middleware import LogRequests, is_slow_query, write_log_line from zerver.middleware import LogRequests, is_slow_query, write_log_line
from zerver.models import get_realm from zerver.models.realms import get_realm
from zilencer.models import RemoteZulipServer from zilencer.models import RemoteZulipServer

View File

@ -8,7 +8,8 @@ from zerver.actions.message_send import create_mirror_user_if_needed
from zerver.lib.create_user import create_user_profile from zerver.lib.create_user import create_user_profile
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
from zerver.models import UserProfile, get_client, get_realm from zerver.models import UserProfile, get_client
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
from zerver.views.message_send import InvalidMirrorInputError, create_mirrored_message_users from zerver.views.message_send import InvalidMirrorInputError, create_mirrored_message_users

View File

@ -13,7 +13,8 @@ from zerver.actions.create_user import notify_new_user
from zerver.actions.user_settings import do_change_user_setting from zerver.actions.user_settings import do_change_user_setting
from zerver.lib.initial_password import initial_password from zerver.lib.initial_password import initial_password
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, Realm, Recipient, Stream, UserProfile, get_realm from zerver.models import Message, Realm, Recipient, Stream, UserProfile
from zerver.models.realms import get_realm
from zerver.signals import JUST_CREATED_THRESHOLD, get_device_browser, get_device_os from zerver.signals import JUST_CREATED_THRESHOLD, get_device_browser, get_device_os
if sys.version_info < (3, 9): # nocoverage if sys.version_info < (3, 9): # nocoverage

View File

@ -12,7 +12,8 @@ from zerver.lib.outgoing_webhook import get_service_interface_class, process_suc
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import datetime_to_timestamp from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.topic import TOPIC_NAME from zerver.lib.topic import TOPIC_NAME
from zerver.models import SLACK_INTERFACE, Message, NotificationTriggers, get_realm, get_stream from zerver.models import SLACK_INTERFACE, Message, NotificationTriggers, get_stream
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user
from zerver.openapi.openapi import validate_against_openapi_schema from zerver.openapi.openapi import validate_against_openapi_schema

View File

@ -19,7 +19,8 @@ from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.topic import TOPIC_NAME from zerver.lib.topic import TOPIC_NAME
from zerver.lib.url_encoding import near_message_url from zerver.lib.url_encoding import near_message_url
from zerver.lib.users import add_service from zerver.lib.users import add_service
from zerver.models import Recipient, Service, UserProfile, get_realm, get_stream from zerver.models import Recipient, Service, UserProfile, get_stream
from zerver.models.realms import get_realm
class ResponseMock: class ResponseMock:

View File

@ -18,8 +18,8 @@ from zerver.models import (
UserActivityInterval, UserActivityInterval,
UserPresence, UserPresence,
UserProfile, UserProfile,
get_realm,
) )
from zerver.models.realms import get_realm
class TestClientModel(ZulipTestCase): class TestClientModel(ZulipTestCase):

View File

@ -91,9 +91,9 @@ from zerver.models import (
UserProfile, UserProfile,
UserTopic, UserTopic,
get_client, get_client,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zilencer.models import RemoteZulipServerAuditLog from zilencer.models import RemoteZulipServerAuditLog
from zilencer.views import DevicesToCleanUpDict from zilencer.views import DevicesToCleanUpDict

View File

@ -32,9 +32,9 @@ from zerver.models import (
UserActivity, UserActivity,
UserProfile, UserProfile,
get_client, get_client,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.tornado.event_queue import build_offline_notification from zerver.tornado.event_queue import build_offline_notification
from zerver.worker import queue_processors from zerver.worker import queue_processors
from zerver.worker.queue_processors import ( from zerver.worker.queue_processors import (

View File

@ -12,7 +12,8 @@ from zerver.lib.exceptions import JsonableError
from zerver.lib.message import extract_message_dict from zerver.lib.message import extract_message_dict
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import zulip_reaction_info from zerver.lib.test_helpers import zulip_reaction_info
from zerver.models import Message, Reaction, RealmEmoji, UserMessage, get_realm from zerver.models import Message, Reaction, RealmEmoji, UserMessage
from zerver.models.realms import get_realm
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -53,10 +53,10 @@ from zerver.models import (
UserGroupMembership, UserGroupMembership,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_realm,
get_stream, get_stream,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user_profile_by_id from zerver.models.users import get_system_bot, get_user_profile_by_id

View File

@ -10,7 +10,8 @@ from zerver.actions.users import do_change_user_role
from zerver.lib.domains import validate_domain from zerver.lib.domains import validate_domain
from zerver.lib.email_validation import email_allowed_for_realm from zerver.lib.email_validation import email_allowed_for_realm
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import DomainNotAllowedForRealmError, RealmDomain, UserProfile, get_realm from zerver.models import RealmDomain, UserProfile
from zerver.models.realms import DomainNotAllowedForRealmError, get_realm
class RealmDomainTest(ZulipTestCase): class RealmDomainTest(ZulipTestCase):

View File

@ -9,7 +9,8 @@ from zerver.lib.exceptions import JsonableError
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import get_test_image_file from zerver.lib.test_helpers import get_test_image_file
from zerver.lib.upload.base import BadImageError from zerver.lib.upload.base import BadImageError
from zerver.models import Realm, RealmEmoji, UserProfile, get_realm from zerver.models import Realm, RealmEmoji, UserProfile
from zerver.models.realms import get_realm
class RealmEmojiTest(ZulipTestCase): class RealmEmojiTest(ZulipTestCase):

View File

@ -1,6 +1,7 @@
from zerver.actions.realm_playgrounds import check_add_realm_playground from zerver.actions.realm_playgrounds import check_add_realm_playground
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmPlayground, get_realm from zerver.models import RealmPlayground
from zerver.models.realms import get_realm
class RealmPlaygroundTests(ZulipTestCase): class RealmPlaygroundTests(ZulipTestCase):

View File

@ -38,9 +38,9 @@ from zerver.models import (
SubMessage, SubMessage,
UserMessage, UserMessage,
get_client, get_client,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot
# Class with helper functions useful for testing archiving of reactions: # Class with helper functions useful for testing archiving of reactions:

View File

@ -28,7 +28,8 @@ from zerver.data_import.user_handler import UserHandler
from zerver.lib.emoji import name_to_codepoint from zerver.lib.emoji import name_to_codepoint
from zerver.lib.import_realm import do_import_realm from zerver.lib.import_realm import do_import_realm
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm from zerver.models import Message, Reaction, Recipient, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_user from zerver.models.users import get_user

View File

@ -10,7 +10,8 @@ from typing_extensions import override
from zerver.actions.user_settings import do_change_full_name from zerver.actions.user_settings import do_change_full_name
from zerver.lib.scim import ZulipSCIMUser from zerver.lib.scim import ZulipSCIMUser
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import UserProfile, get_realm from zerver.models import UserProfile
from zerver.models.realms import get_realm
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -15,7 +15,8 @@ from zerver.lib.bot_storage import StateError
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publish from zerver.lib.test_helpers import mock_queue_publish
from zerver.lib.validator import check_string from zerver.lib.validator import check_string
from zerver.models import NotificationTriggers, Recipient, UserProfile, get_realm from zerver.models import NotificationTriggers, Recipient, UserProfile
from zerver.models.realms import get_realm
BOT_TYPE_TO_QUEUE_NAME = { BOT_TYPE_TO_QUEUE_NAME = {
UserProfile.OUTGOING_WEBHOOK_BOT: "outgoing_webhooks", UserProfile.OUTGOING_WEBHOOK_BOT: "outgoing_webhooks",

View File

@ -18,7 +18,8 @@ from zerver.lib.sessions import (
user_sessions, user_sessions,
) )
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Realm, UserProfile, get_realm from zerver.models import Realm, UserProfile
from zerver.models.realms import get_realm
class TestSessions(ZulipTestCase): class TestSessions(ZulipTestCase):

View File

@ -76,9 +76,9 @@ from zerver.models import (
Subscription, Subscription,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
from zerver.views.auth import redirect_and_log_into_subdomain, start_two_factor_auth from zerver.views.auth import redirect_and_log_into_subdomain, start_two_factor_auth
from zerver.views.development.registration import confirmation_key from zerver.views.development.registration import confirmation_key

View File

@ -48,7 +48,8 @@ from zerver.lib.import_realm import do_import_realm
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import read_test_image_file from zerver.lib.test_helpers import read_test_image_file
from zerver.lib.topic import EXPORT_TOPIC_NAME from zerver.lib.topic import EXPORT_TOPIC_NAME
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile, get_realm from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile
from zerver.models.realms import get_realm
def remove_folder(path: str) -> None: def remove_folder(path: str) -> None:

View File

@ -27,9 +27,9 @@ from zerver.models import (
UserActivity, UserActivity,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_realm,
get_stream, get_stream,
) )
from zerver.models.realms import get_realm
logger_string = "zulip.soft_deactivation" logger_string = "zulip.soft_deactivation"

View File

@ -105,11 +105,11 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_default_stream_groups, get_default_stream_groups,
get_realm,
get_stream, get_stream,
validate_attachment_request, validate_attachment_request,
validate_attachment_request_for_spectator_access, validate_attachment_request_for_spectator_access,
) )
from zerver.models.realms import get_realm
from zerver.models.users import active_non_guest_user_ids, get_user, get_user_profile_by_id_in_realm from zerver.models.users import active_non_guest_user_ids, get_user, get_user_profile_by_id_in_realm
from zerver.views.streams import compose_views from zerver.views.streams import compose_views

View File

@ -45,9 +45,9 @@ from zerver.models import (
Realm, Realm,
RealmDomain, RealmDomain,
UserProfile, UserProfile,
get_realm,
validate_attachment_request, validate_attachment_request,
) )
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot, get_user_by_delivery_email from zerver.models.users import get_system_bot, get_user_by_delivery_email

View File

@ -22,7 +22,8 @@ from zerver.lib.upload import (
) )
from zerver.lib.upload.base import DEFAULT_EMOJI_SIZE, MEDIUM_AVATAR_SIZE, resize_avatar from zerver.lib.upload.base import DEFAULT_EMOJI_SIZE, MEDIUM_AVATAR_SIZE, resize_avatar
from zerver.lib.upload.local import write_local_file from zerver.lib.upload.local import write_local_file
from zerver.models import Attachment, RealmEmoji, get_realm from zerver.models import Attachment, RealmEmoji
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot

View File

@ -36,7 +36,8 @@ from zerver.lib.upload.base import (
resize_avatar, resize_avatar,
) )
from zerver.lib.upload.s3 import S3UploadBackend from zerver.lib.upload.s3 import S3UploadBackend
from zerver.models import Attachment, RealmEmoji, UserProfile, get_realm from zerver.models import Attachment, RealmEmoji, UserProfile
from zerver.models.realms import get_realm
from zerver.models.users import get_system_bot from zerver.models.users import get_system_bot

View File

@ -32,15 +32,9 @@ from zerver.lib.user_groups import (
is_user_in_group, is_user_in_group,
user_groups_in_realm_serialized, user_groups_in_realm_serialized,
) )
from zerver.models import ( from zerver.models import GroupGroupMembership, Realm, UserGroup, UserGroupMembership, UserProfile
GroupGroupMembership,
Realm,
UserGroup,
UserGroupMembership,
UserProfile,
get_realm,
)
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import get_realm
class UserGroupTestCase(ZulipTestCase): class UserGroupTestCase(ZulipTestCase):

View File

@ -59,7 +59,6 @@ from zerver.lib.users import (
from zerver.lib.utils import assert_is_not_none from zerver.lib.utils import assert_is_not_none
from zerver.models import ( from zerver.models import (
CustomProfileField, CustomProfileField,
InvalidFakeEmailDomainError,
Message, Message,
OnboardingStep, OnboardingStep,
PreregistrationUser, PreregistrationUser,
@ -76,11 +75,10 @@ from zerver.models import (
check_valid_user_ids, check_valid_user_ids,
filter_to_valid_prereg_users, filter_to_valid_prereg_users,
get_client, get_client,
get_fake_email_domain,
get_realm,
get_stream, get_stream,
) )
from zerver.models.groups import SystemGroups from zerver.models.groups import SystemGroups
from zerver.models.realms import InvalidFakeEmailDomainError, get_fake_email_domain, get_realm
from zerver.models.users import ( from zerver.models.users import (
get_source_profile, get_source_profile,
get_system_bot, get_system_bot,

Some files were not shown because too many files have changed in this diff Show More