示例#1
0
def test_create_app_in_repo(runner, make_git_repo, saved_user, fake_api_client):
    app = 'app1'
    fake_api_client.get_application_git_remote.return_value = 'remote'
    result = runner.invoke(entry, ['create', app])
    assert result.exit_code == 0
    assert app in result.output
    fake_api_client.create_application.assert_called_once_with(app, None)
    git = GitVcs()
    assert git.get_remotes()['tigerhost'] == 'remote'
示例#2
0
def test_create_app_in_repo_failed_connection(runner, make_git_repo, saved_user, fake_api_client):
    app = 'app1'
    fake_api_client.get_application_git_remote.side_effect = ApiClientResponseError(
        None)
    result = runner.invoke(entry, ['create', app])
    assert result.exit_code == 0
    assert app in result.output
    fake_api_client.create_application.assert_called_once_with(app, None)
    git = GitVcs()
    assert 'tigerhost' not in git.get_remotes()
示例#3
0
def test_create_app_in_repo(runner, make_git_repo, saved_user,
                            fake_api_client):
    app = 'app1'
    fake_api_client.get_application_git_remote.return_value = 'remote'
    result = runner.invoke(entry, ['create', app])
    assert result.exit_code == 0
    assert app in result.output
    fake_api_client.create_application.assert_called_once_with(app, None)
    git = GitVcs()
    assert git.get_remotes()['tigerhost'] == 'remote'
示例#4
0
def test_create_app_in_repo_failed_connection(runner, make_git_repo,
                                              saved_user, fake_api_client):
    app = 'app1'
    fake_api_client.get_application_git_remote.side_effect = ApiClientResponseError(
        None)
    result = runner.invoke(entry, ['create', app])
    assert result.exit_code == 0
    assert app in result.output
    fake_api_client.create_application.assert_called_once_with(app, None)
    git = GitVcs()
    assert 'tigerhost' not in git.get_remotes()
示例#5
0
def test_git_remotes(runner, make_app, app_id):
    """
    @type runner: click.testing.CliRunner
    """
    remote = 'tigerhost2'
    result = runner.invoke(entry, ['git:remote', '--app', app_id, '--remote', remote])
    assert result.exit_code == 0
    assert remote in result.output

    git = GitVcs()
    remotes = git.get_remotes()
    assert remotes[remote] == remotes['tigerhost']
示例#6
0
def test_git_remotes(runner, make_app, app_id):
    """
    @type runner: click.testing.CliRunner
    """
    remote = 'tigerhost2'
    result = runner.invoke(entry,
                           ['git:remote', '--app', app_id, '--remote', remote])
    assert result.exit_code == 0
    assert remote in result.output

    git = GitVcs()
    remotes = git.get_remotes()
    assert remotes[remote] == remotes['tigerhost']