18 lines
732 B
Python
18 lines
732 B
Python
import re
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_production_compose_configuration_matches_settings_environment_keys():
|
|
compose = (ROOT / 'docker-compose.yml').read_text()
|
|
settings = (ROOT / 'backend' / 'app' / 'core' / 'config.py').read_text()
|
|
database = (ROOT / 'backend' / 'app' / 'database.py').read_text()
|
|
|
|
compose_keys = set(re.findall(r'\b(LINKLOG_[A-Z0-9_]+):', compose))
|
|
settings_keys = set(re.findall(r"os\.getenv\('([^']+)'", settings + database))
|
|
|
|
assert {'LINKLOG_TOKEN_EXPIRY_MINUTES', 'LINKLOG_REFRESH_TOKEN_EXPIRY_DAYS'} <= compose_keys
|
|
assert compose_keys & settings_keys == compose_keys
|
|
assert 'LINKLOG_TOKEN_EXPIRY_DAYS' not in compose_keys |