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
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
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]
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]