Finish AirDef catalog, route, stock and observation fixes
build / mod (push) Successful in 30m46s

Refs #91, #114, #118, #135. Show the latest recorded unit decision in the native card (#153).
This commit is contained in:
2026-12-02 18:22:22 +03:00
parent 9e0cec13f2
commit 7612d15963
38 changed files with 942 additions and 737 deletions
+12 -7
View File
@@ -34,17 +34,22 @@ class ContentCatalogTests(unittest.TestCase):
self.assertEqual(language[f"item.airdef.{name}"], title)
self.assertTrue((root / "airdef-mod/data/airdef/horizon/item" / (name + ".json")).is_file())
def test_a_new_unit_kind_needs_only_catalog_entries(self):
# The validator must not carry its own list of kind names: a hypothetical unit is
# accepted from a specs row plus its content entry, with no code change.
def test_a_new_unit_kind_needs_one_catalog_row(self):
from gen_catalog import generate, generate_unit_specs
data = json.loads(json.dumps(catalog.load_specs()))
content = json.loads(json.dumps(catalog.load()))
template = next(entry for entry in data["units"] if entry["gun"] is not None)
added = dict(template, kind="TestGun", key="testgun", name="Test gun")
item = {"id": "deploy_testgun", "title": "Test remote", "color": [42, 42, 42]}
added = dict(template, kind="TestGun", key="testgun", name="Test gun", item=item)
data["units"].append(added)
content["units"].append({"kind": "TestGun", "item": None})
events = {entry["event"] for entry in catalog.load_sounds()}
catalog.validate_specs(data, content, events)
catalog.validate_specs(data, events)
content = catalog.load(data)
self.assertIn(item, content["items"])
self.assertIn('kind: SamKind::TestGun, deploy_item: "airdef:deploy_testgun"', generate(content))
generated = generate_unit_specs(data)
self.assertIn(" TestGun,", generated)
self.assertIn(" SamKind::TestGun,", generated)
class ManifestTests(unittest.TestCase):