def test_get_commits_all_of_them(checked_out_repo): with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock: commit = repo_parser.Commit('sha', 123) cmd_output_mock.return_value = '\n'.join( six.text_type(part) for part in commit) + '\n' all_commits = checked_out_repo.repo_parser.get_commits() assert all_commits == [commit]
def test_get_commits_after_date(checked_out_repo): with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock: previous_sha = '29d0d321f43950fd2aa1d1df9fc81dee0e9046b3' commit = repo_parser.Commit(previous_sha, 123) cmd_output_mock.return_value = '\n'.join(str(part) for part in commit) + '\n' checked_out_repo.repo_parser.get_commits(previous_sha) assert (f'{previous_sha}..HEAD' in cmd_output_mock.call_args[0])