mirror of https://github.com/zulip/zulip.git
testing: Use zulip_test_template for backend.
Instead of zulip_test, use zulip_test_template for backend DB. This makes sure that the DB used by backend tests is different from the DB, which will be zulip_test, used by Casper tests.
This commit is contained in:
parent
bf713bcdfe
commit
a507a47778
|
@ -8,6 +8,7 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, \
|
|||
from unittest import loader, runner # type: ignore # Mypy cannot pick these up.
|
||||
from unittest.result import TestResult
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import connections
|
||||
from django.test import TestCase
|
||||
from django.test import runner as django_runner
|
||||
|
@ -386,6 +387,7 @@ class Runner(DiscoverRunner):
|
|||
|
||||
def setup_test_environment(self, *args, **kwargs):
|
||||
# type: (*Any, **Any) -> Any
|
||||
settings.DATABASES['default']['NAME'] = settings.BACKEND_DATABASE_TEMPLATE
|
||||
destroy_test_databases(self.database_id)
|
||||
create_test_databases(self.database_id)
|
||||
return super(Runner, self).setup_test_environment(*args, **kwargs)
|
||||
|
|
|
@ -19,6 +19,9 @@ if os.getenv("EXTERNAL_HOST") is None:
|
|||
os.environ["EXTERNAL_HOST"] = "testserver"
|
||||
from .settings import *
|
||||
|
||||
# Used to clone DBs in backend tests.
|
||||
BACKEND_DATABASE_TEMPLATE = 'zulip_test_template'
|
||||
|
||||
DATABASES["default"] = {
|
||||
"NAME": "zulip_test",
|
||||
"USER": "zulip_test",
|
||||
|
|
Loading…
Reference in New Issue