Ejemplo n.º 1
0
def test_git_commit_calls_push_when_autopush_set(mocker, mock_process):
    message = 'Initial commit'
    cmd = ['git', 'commit', '-m', message]
    repo = Repository('path', autopush=['origin', 'master'])
    mocker.patch.object(repo, 'push')

    repo.commit(message)
    assert repo.push.called
Ejemplo n.º 2
0
def test_git_commit_calls_push_when_autopush_set(mocker, mock_process):
    message = 'Initial commit'
    cmd = ['git', 'commit', '-m', message]
    repo = Repository('path', autopush=['origin', 'master'])
    mocker.patch.object(repo, 'push')

    repo.commit(message)
    assert repo.push.called
Ejemplo n.º 3
0
def test_git_commit_creates_commit_with_message(mocker, mock_process):
    message = 'Initial commit'
    cmd = ['git', 'commit', '-m', message]
    repo = Repository('path')
    mocker.patch.object(repo, 'add')

    repo.commit(message)

    repo.add.assert_called_once_with(all=True)
    mock_process.call.assert_called_once_with(cmd, cwd=repo.path)
Ejemplo n.º 4
0
def test_git_commit_creates_commit_with_message(mocker, mock_process):
    message = 'Initial commit'
    repo = Repository('path')
    mocker.patch.object(repo, 'add')
    cmd = ['git', 'commit', '--author={}'.format(repo.author), '-m', message]

    repo.commit(message)

    repo.add.assert_called_once_with(all=True)
    mock_process.call.assert_any_call(cmd, cwd=repo.path)
Ejemplo n.º 5
0
def test_git_commit_creates_commit_with_message(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    path = 'some_path'
    message = 'Initial commit'

    git = Repository(path)
    git.commit(message)

    MockRepo().git.add.assert_called_once_with(all=True)
    MockRepo().index.commit.assert_called_once_with(message)
Ejemplo n.º 6
0
def test_git_commit_creates_commit_with_message(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    path = 'some_path'
    message = 'Initial commit'

    git = Repository(path)
    git.commit(message)

    MockRepo().git.add.assert_called_once_with(all=True)
    MockRepo().index.commit.assert_called_once_with(message)