Ejemplo n.º 1
0
def test_commit_by_index_returns_none_when_index_not_found(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    mock_repo = MockRepo()
    commits = []
    mock_repo.iter_commits.return_value = commits
    index = len(commits) + 1

    git = Repository('path')
    commit = git.commit_by_index(index)

    assert commit is None
Ejemplo n.º 2
0
def test_commit_by_index_returns_none_when_index_not_found(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    mock_repo = MockRepo()
    commits = []
    mock_repo.iter_commits.return_value = commits
    index = len(commits) + 1

    git = Repository('path')
    commit = git.commit_by_index(index)

    assert commit is None
Ejemplo n.º 3
0
def test_commit_by_index_returns_found_commit_when_index_exists(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    mock_repo = MockRepo()
    commits = ['initial commit']
    mock_repo.iter_commits.return_value = commits
    index = 0

    git = Repository('path')
    commit = git.commit_by_index(index)

    assert commit == commits[0]
Ejemplo n.º 4
0
def test_commit_by_index_returns_found_commit_when_index_exists(mocker):
    MockRepo = mocker.patch('passpie.history.Repo')
    mock_repo = MockRepo()
    commits = ['initial commit']
    mock_repo.iter_commits.return_value = commits
    index = 0

    git = Repository('path')
    commit = git.commit_by_index(index)

    assert commit == commits[0]