Beispiel #1
0
def merge_prs() -> Union[res.ResponseFailure, res.ResponseSuccess]:
    """Batch merge of pull requests on GitHub."""
    github_service = _get_github_service(CONFIG_MANAGER.config)
    pr_merge = p.InquirerPrompter.merge_pull_requests(
        github_service.get_username(),
        CONFIG_MANAGER.config.github_selected_repos,
    )
    return ghmp.GhMergePrUseCase(CONFIG_MANAGER,
                                 github_service).execute(pr_merge)
def test_execute_for_specific_repo(
    mock_config_manager: MockerFixture,
    mock_github_service: MockerFixture,
    domain_mprs: List[mpr.PullRequestMerge],
) -> None:
    """It returns success."""
    config_manager = mock_config_manager.return_value
    github_service = mock_github_service.return_value
    response = ghmp.GhMergePrUseCase(config_manager, github_service).execute(
        domain_mprs[0], "staticdev/omg")
    assert bool(response) is True
    assert "success message\n" == response.value
def test_execute_delete_branch(
    mock_config_manager: MockerFixture,
    mock_github_service: MockerFixture,
    mock_gh_delete_branch_use_case: MockerFixture,
    domain_mprs: List[mpr.PullRequestMerge],
) -> None:
    """It returns success."""
    config_manager = mock_config_manager.return_value
    github_service = mock_github_service.return_value
    response = ghmp.GhMergePrUseCase(config_manager,
                                     github_service).execute(domain_mprs[1])

    assert bool(response) is True
    assert "success message\nsuccess message\n" == response.value
    mock_gh_delete_branch_use_case.assert_called()