Add Chzzk campaign and reward models, import command, and schemas
Some checks failed
Deploy to Server / deploy (push) Failing after 19s
Some checks failed
Deploy to Server / deploy (push) Failing after 19s
This commit is contained in:
parent
c852134338
commit
677aedf42b
14 changed files with 650 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ import os
|
|||
import sys
|
||||
from contextlib import contextmanager
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from django.contrib.sessions.models import Session
|
||||
|
|
@ -249,14 +250,14 @@ def test_email_settings_from_env(
|
|||
assert reloaded.SERVER_EMAIL == "me@example.com"
|
||||
|
||||
|
||||
def test_database_settings_when_not_testing(
|
||||
def test_database_settings_when_use_sqlite_enabled(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
reload_settings_module: Callable[..., ModuleType],
|
||||
) -> None:
|
||||
"""When not running tests, DATABASES should use the Postgres configuration."""
|
||||
# Ensure the module believes it's not running tests
|
||||
"""When USE_SQLITE=1 and not testing, DATABASES should use SQLite file."""
|
||||
monkeypatch.setattr("sys.argv", ["manage.py", "runserver"])
|
||||
monkeypatch.delenv("PYTEST_VERSION", raising=False)
|
||||
monkeypatch.setenv("USE_SQLITE", "1")
|
||||
|
||||
reloaded: ModuleType = reload_settings_module(
|
||||
TESTING=None,
|
||||
|
|
@ -271,7 +272,36 @@ def test_database_settings_when_not_testing(
|
|||
)
|
||||
|
||||
assert reloaded.TESTING is False
|
||||
db_cfg = reloaded.DATABASES["default"]
|
||||
db_cfg: dict[str, Any] = reloaded.DATABASES["default"]
|
||||
assert db_cfg["ENGINE"] == "django.db.backends.sqlite3"
|
||||
# Should use a file, not in-memory
|
||||
assert db_cfg["NAME"].endswith("db.sqlite3")
|
||||
|
||||
|
||||
def test_database_settings_when_not_testing(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
reload_settings_module: Callable[..., ModuleType],
|
||||
) -> None:
|
||||
"""When not running tests, DATABASES should use the Postgres configuration."""
|
||||
# Ensure the module believes it's not running tests and USE_SQLITE is unset
|
||||
monkeypatch.setattr("sys.argv", ["manage.py", "runserver"])
|
||||
monkeypatch.delenv("PYTEST_VERSION", raising=False)
|
||||
monkeypatch.setenv("USE_SQLITE", "0")
|
||||
|
||||
reloaded: ModuleType = reload_settings_module(
|
||||
TESTING=None,
|
||||
PYTEST_VERSION=None,
|
||||
POSTGRES_DB="prod_db",
|
||||
POSTGRES_USER="prod_user",
|
||||
POSTGRES_PASSWORD="secret",
|
||||
POSTGRES_HOST="db.host",
|
||||
POSTGRES_PORT="5433",
|
||||
CONN_MAX_AGE="120",
|
||||
CONN_HEALTH_CHECKS="0",
|
||||
)
|
||||
|
||||
assert reloaded.TESTING is False
|
||||
db_cfg: dict[str, Any] = reloaded.DATABASES["default"]
|
||||
assert db_cfg["ENGINE"] == "django.db.backends.postgresql"
|
||||
assert db_cfg["NAME"] == "prod_db"
|
||||
assert db_cfg["USER"] == "prod_user"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue