Skip to content

Commit d241be4

Browse files
committed
add test
1 parent 50be28f commit d241be4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/integrations/github/cicd/test_github_controller.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,3 +735,46 @@ def test_pr_comment_deploy_indicator_includes_command_namespace(
735735

736736
assert "To **apply** this PR's plan to prod, comment:\n - `/deploy`" not in comment
737737
assert "To **apply** this PR's plan to prod, comment:\n - `#SQLMesh/deploy`" in comment
738+
739+
740+
def test_forward_only_config_falls_back_to_plan_config(
741+
github_client,
742+
make_controller: t.Callable[..., GithubController],
743+
mocker: MockerFixture,
744+
):
745+
mock_repo = github_client.get_repo()
746+
mock_repo.create_check_run = mocker.MagicMock(
747+
side_effect=lambda **kwargs: make_mock_check_run(**kwargs)
748+
)
749+
750+
created_comments = []
751+
mock_issue = mock_repo.get_issue()
752+
mock_issue.create_comment = mocker.MagicMock(
753+
side_effect=lambda comment: make_mock_issue_comment(
754+
comment=comment, created_comments=created_comments
755+
)
756+
)
757+
mock_issue.get_comments = mocker.MagicMock(side_effect=lambda: created_comments)
758+
759+
mock_pull_request = mock_repo.get_pull()
760+
mock_pull_request.get_reviews = mocker.MagicMock(lambda: [])
761+
mock_pull_request.merged = False
762+
mock_pull_request.merge = mocker.MagicMock()
763+
mock_pull_request.head.ref = "unit-test-test-pr"
764+
765+
controller = make_controller(
766+
"tests/fixtures/github/pull_request_synchronized.json",
767+
github_client,
768+
bot_config=GithubCICDBotConfig(
769+
merge_method=MergeMethod.SQUASH,
770+
enable_deploy_command=True,
771+
forward_only_branch_suffix="-forward-only",
772+
),
773+
mock_out_context=False,
774+
)
775+
776+
controller._context.config.plan.forward_only = True
777+
assert controller.forward_only_plan
778+
779+
controller._context.config.plan.forward_only = False
780+
assert controller.forward_only_plan is False

0 commit comments

Comments
 (0)