def test_execute_delete_branch_for_specific_repo(
    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], "staticdev/omg")

    assert bool(response) is True
    assert "success message\n" == response.value
    mock_gh_delete_branch_use_case.assert_called_once()
Пример #2
0
def test_save_config_success(
    tmp_path: Path,
    mock_yaml_dump: MockerFixture,
    mock_os_join_path: MockerFixture,
) -> None:
    """It dumps yaml config file."""
    filename = "config.yaml"
    content = ("github_access_token: aaaaabbbbbccccc12345\n"
               "github_hostname: ''\n"
               "github_selected_repos:\n"
               " - staticdev/test\n")
    d = tmp_path
    p = d / filename
    p.write_text(content)
    mock_os_join_path.side_effect = [str(d), str(p)]
    manager = cm.ConfigManager()
    manager.save_config()
    mock_yaml_dump.assert_called_once()