mirror of https://github.com/zulip/zulip.git
typing: Add assertions before accessing settings.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
a09c9a4063
commit
7c62af0d73
|
@ -83,6 +83,7 @@ def init_fakeldap(
|
|||
mock_ldap = MockLDAP()
|
||||
mock_initialize.return_value = mock_ldap
|
||||
|
||||
assert settings.FAKE_LDAP_MODE is not None
|
||||
mock_ldap.directory = directory or generate_dev_ldap_dir(
|
||||
settings.FAKE_LDAP_MODE, settings.FAKE_LDAP_NUM_USERS
|
||||
)
|
||||
|
|
|
@ -107,6 +107,7 @@ class Command(ZulipBaseCommand):
|
|||
print("Mobile Push Notification Service registration successfully updated!")
|
||||
|
||||
def _request_push_notification_bouncer_url(self, url: str, params: Dict[str, Any]) -> Response:
|
||||
assert settings.PUSH_NOTIFICATION_BOUNCER_URL is not None
|
||||
registration_url = settings.PUSH_NOTIFICATION_BOUNCER_URL + url
|
||||
session = PushBouncerSession()
|
||||
try:
|
||||
|
|
|
@ -19,6 +19,7 @@ from zerver.models import UserProfile
|
|||
# since we rearranged the avatars in Zulip 1.6.
|
||||
def patched_user_avatar_path(user_profile: UserProfile) -> str:
|
||||
email = user_profile.email
|
||||
assert settings.AVATAR_SALT is not None
|
||||
user_key = email.lower() + settings.AVATAR_SALT
|
||||
return make_safe_digest(user_key, hashlib.sha1)
|
||||
|
||||
|
|
|
@ -220,6 +220,7 @@ class EventsEndpointTest(ZulipTestCase):
|
|||
self.assertEqual(str(context.exception), "Access denied")
|
||||
self.assertEqual(context.exception.http_status_code, 403)
|
||||
|
||||
assert settings.SHARED_SECRET is not None
|
||||
post_data["secret"] = settings.SHARED_SECRET
|
||||
req = HostRequestMock(post_data, tornado_handler=dummy_handler)
|
||||
req.META["REMOTE_ADDR"] = "127.0.0.1"
|
||||
|
|
|
@ -131,6 +131,7 @@ class ExportFile(ZulipTestCase):
|
|||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
assert settings.LOCAL_UPLOADS_DIR is not None
|
||||
self.rm_tree(settings.LOCAL_UPLOADS_DIR)
|
||||
|
||||
# Deleting LOCAL_UPLOADS_DIR results in the test database
|
||||
|
|
Loading…
Reference in New Issue