Update deploy workflow to use 'master' branch and add unit tests for deployment triggers
This commit is contained in:
23
tests/test_deploy_workflow.py
Normal file
23
tests/test_deploy_workflow.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class DeployWorkflowTests(unittest.TestCase):
|
||||
def test_deploy_workflow_triggers_on_master_pushes(self):
|
||||
workflow_path = Path(__file__).resolve().parents[1] / ".gitea" / "workflows" / "deploy-ftp.yml"
|
||||
workflow_text = workflow_path.read_text(encoding="utf-8")
|
||||
|
||||
branch_block_match = re.search(
|
||||
r"on:\s*\n\s*push:\s*\n\s*branches:\s*\n(?P<branches>(?:\s*-\s*[^\n]+\n)+)",
|
||||
workflow_text,
|
||||
)
|
||||
|
||||
self.assertIsNotNone(branch_block_match, "workflow should define push branches")
|
||||
branches = re.findall(r"-\s*([^\n]+)", branch_block_match.group("branches"))
|
||||
|
||||
self.assertEqual(branches, ["master"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user