restore-backup, test_docs: Import settings from django.conf.

A settings module isn’t supposed to be imported directly.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-08-27 21:04:21 -07:00 committed by Tim Abbott
parent 4afdfa6055
commit e8ee71e9a2
2 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@ def restore_backup(tarball_file):
# First, we unpack the /etc/zulip configuration, so we know how
# this server is supposed to be configured (and can import
# /etc/zulip/settings.py via `from zproject import settings`,
# /etc/zulip/settings.py via `from django.conf import settings`,
# next). Ignore errors if zulip-backup/settings is not present
# (E.g. because this is a development backup).
tarball_file.seek(0, 0)
@ -44,7 +44,8 @@ def restore_backup(tarball_file):
stdin=tarball_file,
)
from zproject import settings
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
from django.conf import settings
paths = [
("settings", "/etc/zulip"),

View File

@ -4,11 +4,11 @@ import os
import subprocess
import ujson
from django.conf import settings
from django.test import TestCase, override_settings
from django.http import HttpResponse
from typing import Any, Dict, List
from zproject.settings import DEPLOY_ROOT
from zerver.lib.integrations import INTEGRATIONS
from zerver.lib.storage import static_path
from zerver.lib.test_classes import ZulipTestCase
@ -272,7 +272,7 @@ class HelpTest(ZulipTestCase):
class IntegrationTest(TestCase):
def test_check_if_every_integration_has_logo_that_exists(self) -> None:
for integration in INTEGRATIONS.values():
self.assertTrue(os.path.isfile(DEPLOY_ROOT + integration.logo_url), integration.name)
self.assertTrue(os.path.isfile(settings.DEPLOY_ROOT + integration.logo_url), integration.name)
def test_api_url_view_subdomains_base(self) -> None:
context = dict() # type: Dict[str, Any]