mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Reorganises four folders that exceeded the 12-item readability limit: - tests/lint/repository/ (27 -> 11): structure/, naming/, documentation/, python/, dependencies/, shell/, yaml/, network/, settings/ - tests/integration/ (25 -> 7): ansible/, infrastructure/, iam/, meta/ (24 sibling dirs grouped under 4 super-categories) - tests/integration/roles/ (13 -> 10): naming/, playwright/, dashboard/ - tests/unit/utils/ (15 -> 12): certs/ for 3 cert/TLS test files Renames 7 test files whose name duplicated the new folder name (e.g. test_no_direct_yaml_calls.py -> yaml/test_no_direct_calls.py, test_dashboard_integration_scope.py -> dashboard/test_integration_scope.py). Adjusts parents[N] in moved __init__.py files, fixes __file__-based path resolution in 8 tests, updates self-path whitelists, and uses absolute imports for PROJECT_ROOT re-exports (ruff TID252). Adds README.md to each new subfolder following the existing scope template. Updates all docs links (suppression.md, base.md, email.md, playwright spec/parity docs, 005-/019- requirements) to new paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import unittest
|
|
|
|
from plugins.lookup.service import LookupModule
|
|
from utils.cache.yaml import load_yaml_any
|
|
|
|
from . import PROJECT_ROOT
|
|
|
|
|
|
class TestServiceTransitiveDependencies(unittest.TestCase):
|
|
def setUp(self):
|
|
self.repo_root = PROJECT_ROOT
|
|
self.applications = {
|
|
"web-app-dashboard": self._load_yaml(
|
|
"roles", "web-app-dashboard", "meta", "services.yml"
|
|
),
|
|
"web-svc-asset": self._load_yaml(
|
|
"roles", "web-svc-asset", "meta", "services.yml"
|
|
),
|
|
"web-svc-file": self._load_yaml(
|
|
"roles", "web-svc-file", "meta", "services.yml"
|
|
),
|
|
}
|
|
|
|
def _load_yaml(self, *parts):
|
|
path = self.repo_root.joinpath(*parts)
|
|
return load_yaml_any(path) or {}
|
|
|
|
def test_dashboard_needs_file_transitively_via_asset_service(self):
|
|
result = LookupModule().run(
|
|
["file"],
|
|
variables={
|
|
"applications": self.applications,
|
|
"group_names": ["web-app-dashboard"],
|
|
},
|
|
)[0]
|
|
|
|
self.assertTrue(result["required"])
|
|
self.assertEqual(result["id"], "file")
|
|
self.assertEqual(result["role"], "web-svc-file")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|