# HG changeset patch # User Marcin Kuzminski # Date 2019-07-01 18:02:06 # Node ID aceb6b1655fa095f73fb1eff1fd90d9d340f65f2 # Parent 8199476a3d304faa929098c7a0ae99c0668e6690 tests: fixed further tests diff --git a/rhodecode/apps/repository/tests/test_repo_pullrequests.py b/rhodecode/apps/repository/tests/test_repo_pullrequests.py --- a/rhodecode/apps/repository/tests/test_repo_pullrequests.py +++ b/rhodecode/apps/repository/tests/test_repo_pullrequests.py @@ -40,8 +40,8 @@ def route_path(name, params=None, **kwar base_url = { 'repo_changelog': '/{repo_name}/changelog', 'repo_changelog_file': '/{repo_name}/changelog/{commit_id}/{f_path}', - 'repo_commits': '/{repo_name}/changelog', - 'repo_commits_file': '/{repo_name}/changelog/{commit_id}/{f_path}', + 'repo_commits': '/{repo_name}/commits', + 'repo_commits_file': '/{repo_name}/commits/{commit_id}/{f_path}', 'pullrequest_show': '/{repo_name}/pull-request/{pull_request_id}', 'pullrequest_show_all': '/{repo_name}/pull-request', 'pullrequest_show_all_data': '/{repo_name}/pull-request-data', diff --git a/rhodecode/apps/repository/tests/test_repo_summary.py b/rhodecode/apps/repository/tests/test_repo_summary.py --- a/rhodecode/apps/repository/tests/test_repo_summary.py +++ b/rhodecode/apps/repository/tests/test_repo_summary.py @@ -350,11 +350,11 @@ class TestCreateReferenceData(object): { 'children': [ { - 'id': 'a', 'raw_id': 'a_id', 'text': 'a', 'type': 't1', + 'id': 'a', 'idx': 0, 'raw_id': 'a_id', 'text': 'a', 'type': 't1', 'files_url': expected_files_url + 'a/?at=a', }, { - 'id': 'b', 'raw_id': 'b_id', 'text': 'b', 'type': 't1', + 'id': 'b', 'idx': 0, 'raw_id': 'b_id', 'text': 'b', 'type': 't1', 'files_url': expected_files_url + 'b/?at=b', } ], @@ -363,7 +363,7 @@ class TestCreateReferenceData(object): { 'children': [ { - 'id': 'c', 'raw_id': 'c_id', 'text': 'c', 'type': 't2', + 'id': 'c', 'idx': 0, 'raw_id': 'c_id', 'text': 'c', 'type': 't2', 'files_url': expected_files_url + 'c/?at=c', } ], @@ -385,12 +385,12 @@ class TestCreateReferenceData(object): { 'children': [ { - 'id': 'a@a_id', 'raw_id': 'a_id', + 'id': 'a@a_id', 'idx': 0, 'raw_id': 'a_id', 'text': 'a', 'type': 't1', 'files_url': expected_files_url + 'a_id/a?at=a', }, { - 'id': 'b@b_id', 'raw_id': 'b_id', + 'id': 'b@b_id', 'idx': 0, 'raw_id': 'b_id', 'text': 'b', 'type': 't1', 'files_url': expected_files_url + 'b_id/b?at=b', } @@ -400,7 +400,7 @@ class TestCreateReferenceData(object): { 'children': [ { - 'id': 'c@c_id', 'raw_id': 'c_id', + 'id': 'c@c_id', 'idx': 0, 'raw_id': 'c_id', 'text': 'c', 'type': 't2', 'files_url': expected_files_url + 'c_id/c?at=c', } @@ -516,6 +516,7 @@ class TestReferenceItems(object): 'text': ref_name, 'id': self._format_function(ref_name, ref_id), 'raw_id': ref_id, + 'idx': 0, 'type': self.ref_type, 'files_url': self.fake_url } diff --git a/rhodecode/tests/vcs/test_git.py b/rhodecode/tests/vcs/test_git.py --- a/rhodecode/tests/vcs/test_git.py +++ b/rhodecode/tests/vcs/test_git.py @@ -1087,27 +1087,32 @@ class TestGitSpecificWithRepo(BackendTes 'base') def test_get_diff_runs_git_command_with_hashes(self): + comm1 = self.repo[0] + comm2 = self.repo[1] self.repo.run_git_command = mock.Mock(return_value=['', '']) - self.repo.get_diff(self.repo[0], self.repo[1]) + self.repo.get_diff(comm1, comm2) + + self.repo.run_git_command.assert_called_once_with( + ['diff', '-U3', '--full-index', '--binary', '-p', '-M', + '--abbrev=40', comm1.raw_id, comm2.raw_id]) + + def test_get_diff_runs_git_command_with_str_hashes(self): + comm2 = self.repo[1] + self.repo.run_git_command = mock.Mock(return_value=['', '']) + self.repo.get_diff(self.repo.EMPTY_COMMIT, comm2) + self.repo.run_git_command.assert_called_once_with( + ['show', '-U3', '--full-index', '--binary', '-p', '-M', + '--abbrev=40', comm2.raw_id]) + + def test_get_diff_runs_git_command_with_path_if_its_given(self): + comm1 = self.repo[0] + comm2 = self.repo[1] + self.repo.run_git_command = mock.Mock(return_value=['', '']) + self.repo.get_diff(comm1, comm2, 'foo') self.repo.run_git_command.assert_called_once_with( ['diff', '-U3', '--full-index', '--binary', '-p', '-M', '--abbrev=40', self.repo._lookup_commit(0), - self.repo._lookup_commit(1)]) - - def test_get_diff_runs_git_command_with_str_hashes(self): - self.repo.run_git_command = mock.Mock(return_value=['', '']) - self.repo.get_diff(self.repo.EMPTY_COMMIT, self.repo[1]) - self.repo.run_git_command.assert_called_once_with( - ['show', '-U3', '--full-index', '--binary', '-p', '-M', - '--abbrev=40', self.repo._lookup_commit(1)]) - - def test_get_diff_runs_git_command_with_path_if_its_given(self): - self.repo.run_git_command = mock.Mock(return_value=['', '']) - self.repo.get_diff(self.repo[0], self.repo[1], 'foo') - self.repo.run_git_command.assert_called_once_with( - ['diff', '-U3', '--full-index', '--binary', '-p', '-M', - '--abbrev=40', self.repo._lookup_commit(0), - self.repo._lookup_commit(1), '--', 'foo']) + comm2.raw_id, '--', 'foo']) @pytest.mark.usefixtures("vcs_repository_support")