Lightweight containerized prosody tooling + moved auth scripts + xmpp reconnect/auth stabilization
This commit is contained in:
39
core/tests/test_adapter_boundary_rules.py
Normal file
39
core/tests/test_adapter_boundary_rules.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
|
||||
class AdapterBoundaryRulesTests(SimpleTestCase):
|
||||
def test_client_adapters_do_not_import_business_engines(self):
|
||||
clients_dir = Path(__file__).resolve().parents[1] / "clients"
|
||||
banned_prefixes = (
|
||||
"from core.commands",
|
||||
"import core.commands",
|
||||
"from core.tasks",
|
||||
"import core.tasks",
|
||||
"from core.assist",
|
||||
"import core.assist",
|
||||
"from core.translation",
|
||||
"import core.translation",
|
||||
)
|
||||
|
||||
violations = []
|
||||
for file_path in sorted(clients_dir.glob("*.py")):
|
||||
if file_path.name == "__init__.py":
|
||||
continue
|
||||
content = file_path.read_text(encoding="utf-8")
|
||||
for line_no, line in enumerate(content.splitlines(), start=1):
|
||||
stripped = line.strip()
|
||||
if any(stripped.startswith(prefix) for prefix in banned_prefixes):
|
||||
violations.append(f"{file_path.name}:{line_no}: {stripped}")
|
||||
|
||||
self.assertEqual(
|
||||
[],
|
||||
violations,
|
||||
msg=(
|
||||
"Adapter modules must stay translator-only and must not import "
|
||||
"business policy/task/assist/translation engines directly."
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user