tornado: Be more explicit about tornado configuration in testing.

Passing this through the environment needlessly complicates the logic.
This commit is contained in:
Alex Vandiver 2020-09-16 14:47:31 -07:00 committed by Tim Abbott
parent f638518722
commit 922940e223
2 changed files with 11 additions and 8 deletions

View File

@ -24,8 +24,8 @@ from zerver.lib.test_fixtures import update_test_databases_if_required
def set_up_django(external_host: str) -> None: def set_up_django(external_host: str) -> None:
os.environ['FULL_STACK_ZULIP_TEST'] = '1'
os.environ['EXTERNAL_HOST'] = external_host os.environ['EXTERNAL_HOST'] = external_host
os.environ["TORNADO_SERVER"] = "http://127.0.0.1:9983"
os.environ["LOCAL_UPLOADS_DIR"] = get_or_create_dev_uuid_var_path( os.environ["LOCAL_UPLOADS_DIR"] = get_or_create_dev_uuid_var_path(
'test-backend/test_uploads') 'test-backend/test_uploads')
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings'

View File

@ -1,5 +1,5 @@
import os import os
from typing import Dict, List, Tuple from typing import Dict, List, Optional, Tuple
import ldap import ldap
from django_auth_ldap.config import LDAPSearch from django_auth_ldap.config import LDAPSearch
@ -17,6 +17,10 @@ from .settings import (
WEBPACK_LOADER, WEBPACK_LOADER,
) )
FULL_STACK_ZULIP_TEST = "FULL_STACK_ZULIP_TEST" in os.environ
PUPPETEER_TESTS = "PUPPETEER_TESTS" in os.environ
FAKE_EMAIL_DOMAIN = "zulip.testserver" FAKE_EMAIL_DOMAIN = "zulip.testserver"
# Clear out the REALM_HOSTS set in dev_settings.py # Clear out the REALM_HOSTS set in dev_settings.py
@ -36,16 +40,15 @@ DATABASES["default"] = {
"OPTIONS": {"connection_factory": TimeTrackingConnection}, "OPTIONS": {"connection_factory": TimeTrackingConnection},
} }
TORNADO_SERVER = os.environ.get("TORNADO_SERVER") # Tests don't use Tornado by default
if TORNADO_SERVER is not None: TORNADO_SERVER: Optional[str] = None
# This covers the Casper test suite case
pass if FULL_STACK_ZULIP_TEST:
TORNADO_SERVER = "http://127.0.0.1:9983"
else: else:
# This covers the backend test suite case
CAMO_URI = 'https://external-content.zulipcdn.net/external_content/' CAMO_URI = 'https://external-content.zulipcdn.net/external_content/'
CAMO_KEY = 'dummy' CAMO_KEY = 'dummy'
PUPPETEER_TESTS = "PUPPETEER_TESTS" in os.environ
if PUPPETEER_TESTS: if PUPPETEER_TESTS:
# Disable search pills prototype for production use # Disable search pills prototype for production use
SEARCH_PILLS_ENABLED = False SEARCH_PILLS_ENABLED = False