mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 01:53:59 +00:00
This works around a nasty problem with Webpack that you can't run two copies of the Webpack development server on the same project at the same time (even if on different ports). The second copy doesn't fail, it just hangs waiting for some lock, which is confusing; but even if that were to be solved, we don't actually need the webpack development server running to run the Casper tests; we just need bundle.js built. So the easy solution is to just run webpack manually and be sure to include bundle.js in the JS_SPECS entry. As a follow-up to this change, we should clean up how test_settings.py is implemented to not require duplicating code from settings.py. Fixes #878.
73 lines
2.4 KiB
Python
73 lines
2.4 KiB
Python
from __future__ import absolute_import
|
|
from .settings import *
|
|
import os
|
|
|
|
DATABASES["default"] = {"NAME": "zulip_test",
|
|
"USER": "zulip_test",
|
|
"PASSWORD": LOCAL_DATABASE_PASSWORD,
|
|
"HOST": "localhost",
|
|
"SCHEMA": "zulip",
|
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
"TEST_NAME": "django_zulip_tests",
|
|
"OPTIONS": {"connection_factory": TimeTrackingConnection },}
|
|
|
|
# In theory this should just go in zproject/settings.py inside the `if
|
|
# PIPELINE` statement, but because zproject/settings.py is processed
|
|
# first, we have to add it here as a hack.
|
|
JS_SPECS['app']['source_filenames'].append('js/bundle.js')
|
|
|
|
if "TORNADO_SERVER" in os.environ:
|
|
# This covers the Casper test suite case
|
|
TORNADO_SERVER = os.environ["TORNADO_SERVER"]
|
|
else:
|
|
# This covers the backend test suite case
|
|
TORNADO_SERVER = None
|
|
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
|
CAMO_KEY = 'dummy'
|
|
|
|
# Decrease the get_updates timeout to 1 second.
|
|
# This allows CasperJS to proceed quickly to the next test step.
|
|
POLL_TIMEOUT = 1000
|
|
|
|
# Don't use the real message log for tests
|
|
EVENT_LOG_DIR = '/tmp/zulip-test-event-log'
|
|
|
|
# Print our emails rather than sending them
|
|
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
|
|
|
|
# The test suite uses EmailAuthBackend
|
|
AUTHENTICATION_BACKENDS += ('zproject.backends.EmailAuthBackend',)
|
|
|
|
# Makes testing LDAP backend require less mocking
|
|
AUTH_LDAP_ALWAYS_UPDATE_USER = False
|
|
|
|
TEST_SUITE = True
|
|
RATE_LIMITING = False
|
|
# Don't use rabbitmq from the test suite -- the user_profile_ids for
|
|
# any generated queue elements won't match those being used by the
|
|
# real app.
|
|
USING_RABBITMQ = False
|
|
|
|
# Disable the tutorial because it confuses the client tests.
|
|
TUTORIAL_ENABLED = False
|
|
|
|
# Disable use of memcached for caching
|
|
CACHES['database'] = {
|
|
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
|
|
'LOCATION': 'zulip-database-test-cache',
|
|
'TIMEOUT': 3600,
|
|
'CONN_MAX_AGE': 600,
|
|
'OPTIONS': {
|
|
'MAX_ENTRIES': 100000
|
|
}
|
|
}
|
|
|
|
LOGGING['loggers']['zulip.requests']['level'] = 'CRITICAL'
|
|
LOGGING['loggers']['zulip.management']['level'] = 'CRITICAL'
|
|
|
|
LOCAL_UPLOADS_DIR = 'test_uploads'
|
|
|
|
S3_KEY = 'test-key'
|
|
S3_SECRET_KEY = 'test-secret-key'
|
|
S3_AUTH_UPLOADS_BUCKET = 'test-authed-bucket'
|