25 lines
832 B
Python
25 lines
832 B
Python
import pathlib
|
|
import unittest
|
|
import yaml
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
WORKFLOW = ROOT / '.gitea' / 'workflows' / 'agent-pr-gate.yml'
|
|
|
|
|
|
class TestAgentPrWorkflow(unittest.TestCase):
|
|
def test_workflow_exists(self):
|
|
self.assertTrue(WORKFLOW.exists(), 'agent-pr-gate workflow should exist')
|
|
|
|
def test_workflow_has_pr_gate_and_reporting_jobs(self):
|
|
data = yaml.safe_load(WORKFLOW.read_text(encoding='utf-8'))
|
|
self.assertIn('pull_request', data.get('on', {}))
|
|
jobs = data.get('jobs', {})
|
|
self.assertIn('gate', jobs)
|
|
self.assertIn('report', jobs)
|
|
report_steps = jobs['report']['steps']
|
|
self.assertTrue(any('Auto-merge low-risk clean PRs' in (step.get('name') or '') for step in report_steps))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|