"""The fi-daily-research-brief owner declaration parses and its references resolve.""" from pathlib import Path import unittest import yaml ROOT = Path(__file__).resolve().parent.parent DECLARATION = ROOT / 'activity-definitions' / 'fi-daily-research-brief.declaration.yaml' class DeclarationTests(unittest.TestCase): @classmethod def setUpClass(cls): cls.doc = yaml.safe_load(DECLARATION.read_text(encoding='utf-8')) def test_referenced_files_exist(self): inputs = self.doc['inputs'] paths = list(inputs['repository_files']) paths.append(inputs['network']['egress_hosts']) paths.append(self.doc['repository_grant']['publication']['decision']) for rel in paths: self.assertTrue((ROOT / rel).is_file(), rel) def test_grant_is_single_commit_within_briefs(self): grant = self.doc['repository_grant'] self.assertEqual(grant['allowed_paths'], ['briefs/**']) self.assertEqual(grant['commit_count'], {'min': 1, 'max': 1}) self.assertEqual(grant['publication'], {'remote': 'origin', 'ref': 'main', 'mode': 'fast-forward-only', 'decision': grant['publication']['decision']}) def test_completion_requires_published_evidence(self): detail = self.doc['completion']['required_detail'] self.assertIs(detail['pushed'], True) self.assertIn('origin_sha', detail) def test_no_environment_model_selection(self): self.assertNotIn('env', self.doc['model']) if __name__ == '__main__': unittest.main()