feat: add digest-gated internal main deployment
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Failing after 5s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Has been skipped
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped

This commit is contained in:
2026-08-27 12:49:43 +03:00
parent 7a8e5765ad
commit c884b4e3fd
11 changed files with 728 additions and 648 deletions

View File

@@ -0,0 +1,29 @@
import pytest
from django.core.exceptions import ImproperlyConfigured
from settings.base import _env_bool
def test_env_bool_uses_explicit_default(monkeypatch):
monkeypatch.delenv("TEST_BOOLEAN_FLAG", raising=False)
assert _env_bool("TEST_BOOLEAN_FLAG", default=True) is True
assert _env_bool("TEST_BOOLEAN_FLAG", default=False) is False
def test_env_bool_accepts_supported_false_values(monkeypatch):
for value in ("0", "false", "NO", " off "):
monkeypatch.setenv("TEST_BOOLEAN_FLAG", value)
assert _env_bool("TEST_BOOLEAN_FLAG", default=True) is False
def test_env_bool_accepts_supported_true_values(monkeypatch):
for value in ("1", "true", "YES", " on "):
monkeypatch.setenv("TEST_BOOLEAN_FLAG", value)
assert _env_bool("TEST_BOOLEAN_FLAG", default=False) is True
def test_env_bool_rejects_ambiguous_values(monkeypatch):
monkeypatch.setenv("TEST_BOOLEAN_FLAG", "enabled")
with pytest.raises(ImproperlyConfigured, match="TEST_BOOLEAN_FLAG must be one of"):
_env_bool("TEST_BOOLEAN_FLAG", default=True)