tests: fixed further tests

This commit is contained in:
Marcin Kuzminski 2019-07-01 20:02:06 +02:00
parent 073b2bc899
commit 7f271c15c6
3 changed files with 21 additions and 15 deletions

View file

@ -40,8 +40,8 @@ def route_path(name, params=None, **kwargs):
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',

View file

@ -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
}

View file

@ -1087,27 +1087,32 @@ class TestGitSpecificWithRepo(BackendTestMixin):
'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', self.repo._lookup_commit(0),
self.repo._lookup_commit(1)])
'--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, self.repo[1])
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', self.repo._lookup_commit(1)])
'--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(self.repo[0], self.repo[1], 'foo')
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), '--', 'foo'])
comm2.raw_id, '--', 'foo'])
@pytest.mark.usefixtures("vcs_repository_support")