test(domains): read the primary domain from default.env in every test

The hardcoded-primary-domain lint exempted tests/ and scripts/tests/, so test
fixtures kept their own copy of the domain and would drift from
INFINITO_DOMAIN the moment it changes. The lint now scans both trees, and a
unit test pins its scope: only default.env, Markdown, inventories/, .claude/
and build/ may name the domain.

Python tests take the value from default_domain_primary(), and the workspace
helper builds its dashboard and Matomo URLs from INFINITO_DOMAIN once the repo
.env is loaded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-09-24 22:53:54 +02:00
1 parent e8cb94e246
commit e2beab9f1c
34 files changed
+371 -290

No files matched your search

+5 -2
View File
@@ -21,8 +21,11 @@ from utils.cache import _reset_cache_for_tests
from utils.cache import base as cache_base
from utils.cache import users as cache_users
from utils.cache.yaml import dump_yaml_str
from utils.domains.default_primary import default_domain_primary
from utils.roles.mapping import ROLE_FILE_META_SERVICES, ROLE_FILE_META_USERS
DOMAIN = default_domain_primary()
def _write(path: Path, content: str) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
@@ -310,10 +313,10 @@ class TestMaterializeBuiltinUserAliases(unittest.TestCase):
}
out = cache_users._materialize_builtin_user_aliases(
users,
variables={"DOMAIN_PRIMARY": "infinito.test"},
variables={"DOMAIN_PRIMARY": DOMAIN},
templar=None,
)
self.assertEqual(out["sld"]["username"], "infinito")
self.assertEqual(out["sld"]["username"], DOMAIN.split(".", maxsplit=1)[0])
class TestGetUserDefaults(unittest.TestCase):