Show More
@@ -37,11 +37,11 b' class TestCommentCommit(object):' | |||||
37 | assert_error(id_, expected, given=response.body) |
|
37 | assert_error(id_, expected, given=response.body) | |
38 |
|
38 | |||
39 | @pytest.mark.parametrize("commit_id, expected_err", [ |
|
39 | @pytest.mark.parametrize("commit_id, expected_err", [ | |
40 | ('abcabca', {'hg': 'Commit {commit} does not exist for {repo}', |
|
40 | ('abcabca', {'hg': 'Commit {commit} does not exist for `{repo}`', | |
41 | 'git': 'Commit {commit} does not exist for {repo}', |
|
41 | 'git': 'Commit {commit} does not exist for `{repo}`', | |
42 | 'svn': 'Commit id {commit} not understood.'}), |
|
42 | 'svn': 'Commit id {commit} not understood.'}), | |
43 | ('idontexist', {'hg': 'Commit {commit} does not exist for {repo}', |
|
43 | ('idontexist', {'hg': 'Commit {commit} does not exist for `{repo}`', | |
44 | 'git': 'Commit {commit} does not exist for {repo}', |
|
44 | 'git': 'Commit {commit} does not exist for `{repo}`', | |
45 | 'svn': 'Commit id {commit} not understood.'}), |
|
45 | 'svn': 'Commit id {commit} not understood.'}), | |
46 | ]) |
|
46 | ]) | |
47 | def test_api_comment_commit_wrong_hash(self, backend, commit_id, expected_err): |
|
47 | def test_api_comment_commit_wrong_hash(self, backend, commit_id, expected_err): | |
@@ -53,7 +53,7 b' class TestCommentCommit(object):' | |||||
53 |
|
53 | |||
54 | expected_err = expected_err[backend.alias] |
|
54 | expected_err = expected_err[backend.alias] | |
55 | expected_err = expected_err.format( |
|
55 | expected_err = expected_err.format( | |
56 | repo=backend.repo.scm_instance(), commit=commit_id) |
|
56 | repo=backend.repo.scm_instance().name, commit=commit_id) | |
57 | assert_error(id_, expected_err, given=response.body) |
|
57 | assert_error(id_, expected_err, given=response.body) | |
58 |
|
58 | |||
59 | @pytest.mark.parametrize("status_change, message, commit_id", [ |
|
59 | @pytest.mark.parametrize("status_change, message, commit_id", [ |
@@ -40,11 +40,11 b' def route_path(name, params=None, **kwar' | |||||
40 | class TestPullRequestList(object): |
|
40 | class TestPullRequestList(object): | |
41 |
|
41 | |||
42 | @pytest.mark.parametrize('params, expected_title', [ |
|
42 | @pytest.mark.parametrize('params, expected_title', [ | |
43 |
({'source': 0, 'closed': 1}, 'Closed |
|
43 | ({'source': 0, 'closed': 1}, 'Closed'), | |
44 |
({'source': 0, 'my': 1}, ' |
|
44 | ({'source': 0, 'my': 1}, 'Opened by me'), | |
45 |
({'source': 0, 'awaiting_review': 1}, ' |
|
45 | ({'source': 0, 'awaiting_review': 1}, 'Awaiting review'), | |
46 |
({'source': 0, 'awaiting_my_review': 1}, ' |
|
46 | ({'source': 0, 'awaiting_my_review': 1}, 'Awaiting my review'), | |
47 |
({'source': 1}, ' |
|
47 | ({'source': 1}, 'From this repo'), | |
48 | ]) |
|
48 | ]) | |
49 | def test_showing_list_page(self, backend, pr_util, params, expected_title): |
|
49 | def test_showing_list_page(self, backend, pr_util, params, expected_title): | |
50 | pull_request = pr_util.create_pull_request() |
|
50 | pull_request = pr_util.create_pull_request() | |
@@ -55,9 +55,10 b' class TestPullRequestList(object):' | |||||
55 | params=params)) |
|
55 | params=params)) | |
56 |
|
56 | |||
57 | assert_response = response.assert_response() |
|
57 | assert_response = response.assert_response() | |
58 | assert_response.element_equals_to('.panel-title', expected_title) |
|
58 | ||
59 |
element = assert_response.get_element('. |
|
59 | element = assert_response.get_element('.title .active') | |
60 |
element_text = |
|
60 | element_text = element.text_content() | |
|
61 | assert expected_title == element_text | |||
61 |
|
62 | |||
62 | def test_showing_list_page_data(self, backend, pr_util, xhr_header): |
|
63 | def test_showing_list_page_data(self, backend, pr_util, xhr_header): | |
63 | pull_request = pr_util.create_pull_request() |
|
64 | pull_request = pr_util.create_pull_request() |
@@ -156,22 +156,27 b' class TestChangelogController(TestContro' | |||||
156 | def assert_commit_range_on_page( |
|
156 | def assert_commit_range_on_page( | |
157 | self, response, first_idx, last_idx, backend): |
|
157 | self, response, first_idx, last_idx, backend): | |
158 | input_template = ( |
|
158 | input_template = ( | |
159 |
"""<input class="commit-range" |
|
159 | """<input class="commit-range" """ | |
|
160 | """data-commit-id="%(raw_id)s" data-commit-idx="%(idx)s" id="%(raw_id)s" """ | |||
160 | """name="%(raw_id)s" type="checkbox" value="1" />""" |
|
161 | """name="%(raw_id)s" type="checkbox" value="1" />""" | |
161 | ) |
|
162 | ) | |
|
163 | ||||
162 | commit_span_template = """<span class="commit_hash">r%s:%s</span>""" |
|
164 | commit_span_template = """<span class="commit_hash">r%s:%s</span>""" | |
163 | repo = backend.repo |
|
165 | repo = backend.repo | |
164 |
|
166 | |||
165 | first_commit_on_page = repo.get_commit(commit_idx=first_idx) |
|
167 | first_commit_on_page = repo.get_commit(commit_idx=first_idx) | |
166 | response.mustcontain( |
|
168 | response.mustcontain( | |
167 |
input_template % {'raw_id': first_commit_on_page.raw_id |
|
169 | input_template % {'raw_id': first_commit_on_page.raw_id, | |
|
170 | 'idx': first_commit_on_page.idx}) | |||
|
171 | ||||
168 | response.mustcontain(commit_span_template % ( |
|
172 | response.mustcontain(commit_span_template % ( | |
169 | first_commit_on_page.idx, first_commit_on_page.short_id) |
|
173 | first_commit_on_page.idx, first_commit_on_page.short_id) | |
170 | ) |
|
174 | ) | |
171 |
|
175 | |||
172 | last_commit_on_page = repo.get_commit(commit_idx=last_idx) |
|
176 | last_commit_on_page = repo.get_commit(commit_idx=last_idx) | |
173 | response.mustcontain( |
|
177 | response.mustcontain( | |
174 |
input_template % {'raw_id': last_commit_on_page.raw_id |
|
178 | input_template % {'raw_id': last_commit_on_page.raw_id, | |
|
179 | 'idx': last_commit_on_page.idx}) | |||
175 | response.mustcontain(commit_span_template % ( |
|
180 | response.mustcontain(commit_span_template % ( | |
176 | last_commit_on_page.idx, last_commit_on_page.short_id) |
|
181 | last_commit_on_page.idx, last_commit_on_page.short_id) | |
177 | ) |
|
182 | ) |
@@ -234,8 +234,7 b' class GitCommit(base.BaseCommit):' | |||||
234 | path = self._fix_path(path) |
|
234 | path = self._fix_path(path) | |
235 | if self._get_kind(path) != NodeKind.FILE: |
|
235 | if self._get_kind(path) != NodeKind.FILE: | |
236 | raise CommitError( |
|
236 | raise CommitError( | |
237 | "File does not exist for commit %s at '%s'" % |
|
237 | "File does not exist for commit %s at '%s'" % (self.raw_id, path)) | |
238 | (self.raw_id, path)) |
|
|||
239 | return path |
|
238 | return path | |
240 |
|
239 | |||
241 | def _get_file_nodes(self): |
|
240 | def _get_file_nodes(self): | |
@@ -353,8 +352,7 b' class GitCommit(base.BaseCommit):' | |||||
353 | def get_nodes(self, path): |
|
352 | def get_nodes(self, path): | |
354 | if self._get_kind(path) != NodeKind.DIR: |
|
353 | if self._get_kind(path) != NodeKind.DIR: | |
355 | raise CommitError( |
|
354 | raise CommitError( | |
356 | "Directory does not exist for commit %s at " |
|
355 | "Directory does not exist for commit %s at '%s'" % (self.raw_id, path)) | |
357 | " '%s'" % (self.raw_id, path)) |
|
|||
358 | path = self._fix_path(path) |
|
356 | path = self._fix_path(path) | |
359 | id_, _ = self._get_id_for_path(path) |
|
357 | id_, _ = self._get_id_for_path(path) | |
360 | tree_id = self._remote[id_]['id'] |
|
358 | tree_id = self._remote[id_]['id'] |
@@ -240,7 +240,7 b' class GitRepository(BaseRepository):' | |||||
240 | try: |
|
240 | try: | |
241 | commit_id_or_idx = self.commit_ids[int(commit_id_or_idx)] |
|
241 | commit_id_or_idx = self.commit_ids[int(commit_id_or_idx)] | |
242 | except Exception: |
|
242 | except Exception: | |
243 |
msg = "Commit |
|
243 | msg = "Commit {} does not exist for `{}`".format(commit_id_or_idx, self.name) | |
244 | raise CommitDoesNotExistError(msg) |
|
244 | raise CommitDoesNotExistError(msg) | |
245 |
|
245 | |||
246 | elif is_bstr: |
|
246 | elif is_bstr: | |
@@ -262,7 +262,7 b' class GitRepository(BaseRepository):' | |||||
262 |
|
262 | |||
263 | if (not SHA_PATTERN.match(commit_id_or_idx) or |
|
263 | if (not SHA_PATTERN.match(commit_id_or_idx) or | |
264 | commit_id_or_idx not in self.commit_ids): |
|
264 | commit_id_or_idx not in self.commit_ids): | |
265 |
msg = "Commit |
|
265 | msg = "Commit {} does not exist for `{}`".format(commit_id_or_idx, self.name) | |
266 | raise CommitDoesNotExistError(msg) |
|
266 | raise CommitDoesNotExistError(msg) | |
267 |
|
267 | |||
268 | # Ensure we return full id |
|
268 | # Ensure we return full id |
@@ -456,7 +456,7 b' class MercurialRepository(BaseRepository' | |||||
456 | try: |
|
456 | try: | |
457 | raw_id, idx = self._remote.lookup(commit_id, both=True) |
|
457 | raw_id, idx = self._remote.lookup(commit_id, both=True) | |
458 | except CommitDoesNotExistError: |
|
458 | except CommitDoesNotExistError: | |
459 | msg = "Commit {} does not exist for {}".format( |
|
459 | msg = "Commit {} does not exist for `{}`".format( | |
460 | *map(safe_str, [commit_id, self.name])) |
|
460 | *map(safe_str, [commit_id, self.name])) | |
461 | raise CommitDoesNotExistError(msg) |
|
461 | raise CommitDoesNotExistError(msg) | |
462 |
|
462 |
General Comments 0
You need to be logged in to leave comments.
Login now