43 lines
2.0 KiB
Python
43 lines
2.0 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
REFERENCE = ROOT / 'harness/agents/review/skills/gitea-code-review/references/native-review.md'
|
|
SKILL = ROOT / 'harness/agents/review/skills/gitea-code-review/SKILL.md'
|
|
CACHE = ROOT / 'harness/operations/repository-cache.md'
|
|
|
|
|
|
class NativeJournalDocumentationTests(unittest.TestCase):
|
|
def test_canonical_registry_and_legacy_policy_are_explicit(self):
|
|
for path in (REFERENCE, SKILL, CACHE):
|
|
text = path.read_text()
|
|
for token in ('harness/.runtime/native-review-journals',
|
|
'canonical_journal_path', 'register_legacy_journal',
|
|
'binding', 'read-only', 'cross-host'):
|
|
with self.subTest(path=str(path), token=token):
|
|
self.assertIn(token, text)
|
|
|
|
def test_journal_parent_preflight_precedes_expensive_execution(self):
|
|
text = SKILL.read_text()
|
|
entry = text.split('## 진입 조건', 1)[1].split('## 리뷰 관점', 1)[0]
|
|
for requirement in (
|
|
'고비용 리뷰·테스트 실행 전에',
|
|
'$HARNESS_ROOT/harness/.runtime', 'lstat', 'symlink',
|
|
'현재 review role 소유', '정확한 mode `0700`',
|
|
'읽기 전용', 'blocker', '운영자 승인', 'local-only',
|
|
'자동 chmod/chown', 'journal 이동', 'guard 완화',
|
|
'기존 생성 규칙', '게시 승인'):
|
|
with self.subTest(requirement=requirement):
|
|
self.assertIn(requirement, entry)
|
|
|
|
def test_no_caller_selected_journal_in_live_example(self):
|
|
text = REFERENCE.read_text()
|
|
self.assertNotIn('result = native_review.publish(plan, baseline, api, lease, journal_directory)', text)
|
|
self.assertIn('result = native_review.publish(plan, baseline, api, lease)', text)
|
|
self.assertIn('기존 journal을 자동 이동·삭제', text)
|
|
self.assertIn('pending', text)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|