Show More
@@ -299,14 +299,14 b' class TestRepoCommitCommentsView(TestCon' | |||||
299 |
|
299 | |||
300 | def assert_comment_links(response, comments, inline_comments): |
|
300 | def assert_comment_links(response, comments, inline_comments): | |
301 | if comments == 1: |
|
301 | if comments == 1: | |
302 |
comments_text = "%d |
|
302 | comments_text = "%d General" % comments | |
303 | else: |
|
303 | else: | |
304 |
comments_text = "%d |
|
304 | comments_text = "%d General" % comments | |
305 |
|
305 | |||
306 | if inline_comments == 1: |
|
306 | if inline_comments == 1: | |
307 |
inline_comments_text = "%d Inline |
|
307 | inline_comments_text = "%d Inline" % inline_comments | |
308 | else: |
|
308 | else: | |
309 |
inline_comments_text = "%d Inline |
|
309 | inline_comments_text = "%d Inline" % inline_comments | |
310 |
|
310 | |||
311 | if comments: |
|
311 | if comments: | |
312 | response.mustcontain('<a href="#comments">%s</a>,' % comments_text) |
|
312 | response.mustcontain('<a href="#comments">%s</a>,' % comments_text) | |
@@ -315,6 +315,6 b' def assert_comment_links(response, comme' | |||||
315 |
|
315 | |||
316 | if inline_comments: |
|
316 | if inline_comments: | |
317 | response.mustcontain( |
|
317 | response.mustcontain( | |
318 |
'id="inline-comments-counter">%s |
|
318 | 'id="inline-comments-counter">%s' % inline_comments_text) | |
319 | else: |
|
319 | else: | |
320 | response.mustcontain(inline_comments_text) |
|
320 | response.mustcontain(inline_comments_text) |
@@ -20,6 +20,7 b'' | |||||
20 |
|
20 | |||
21 | import pytest |
|
21 | import pytest | |
22 |
|
22 | |||
|
23 | from rhodecode.apps.repository.tests.test_repo_compare import ComparePage | |||
23 | from rhodecode.lib.helpers import _shorten_commit_id |
|
24 | from rhodecode.lib.helpers import _shorten_commit_id | |
24 |
|
25 | |||
25 |
|
26 | |||
@@ -80,18 +81,21 b' class TestRepoCommitView(object):' | |||||
80 | 'svn': '337', |
|
81 | 'svn': '337', | |
81 | } |
|
82 | } | |
82 | diff_stat = { |
|
83 | diff_stat = { | |
83 | 'git': '20 files changed: 941 inserted, 286 deleted', |
|
84 | 'hg': (21, 943, 288), | |
84 | 'svn': '21 files changed: 943 inserted, 288 deleted', |
|
85 | 'git': (20, 941, 286), | |
85 | 'hg': '21 files changed: 943 inserted, 288 deleted', |
|
86 | 'svn': (21, 943, 288), | |
|
87 | } | |||
86 |
|
88 | |||
87 | } |
|
|||
88 | commit_id = commit_id[backend.alias] |
|
89 | commit_id = commit_id[backend.alias] | |
89 | response = self.app.get(route_path( |
|
90 | response = self.app.get(route_path( | |
90 | 'repo_commit', |
|
91 | 'repo_commit', | |
91 | repo_name=backend.repo_name, commit_id=commit_id)) |
|
92 | repo_name=backend.repo_name, commit_id=commit_id)) | |
92 |
|
93 | |||
93 | response.mustcontain(_shorten_commit_id(commit_id)) |
|
94 | response.mustcontain(_shorten_commit_id(commit_id)) | |
94 | response.mustcontain(diff_stat[backend.alias]) |
|
95 | ||
|
96 | compare_page = ComparePage(response) | |||
|
97 | file_changes = diff_stat[backend.alias] | |||
|
98 | compare_page.contains_change_summary(*file_changes) | |||
95 |
|
99 | |||
96 | # files op files |
|
100 | # files op files | |
97 | response.mustcontain('File not present at commit: %s' % |
|
101 | response.mustcontain('File not present at commit: %s' % | |
@@ -127,24 +131,24 b' class TestRepoCommitView(object):' | |||||
127 | response.mustcontain(_shorten_commit_id(commit_ids[0])) |
|
131 | response.mustcontain(_shorten_commit_id(commit_ids[0])) | |
128 | response.mustcontain(_shorten_commit_id(commit_ids[1])) |
|
132 | response.mustcontain(_shorten_commit_id(commit_ids[1])) | |
129 |
|
133 | |||
|
134 | compare_page = ComparePage(response) | |||
|
135 | ||||
130 | # svn is special |
|
136 | # svn is special | |
131 | if backend.alias == 'svn': |
|
137 | if backend.alias == 'svn': | |
132 | response.mustcontain('new file 10644') |
|
138 | response.mustcontain('new file 10644') | |
133 | response.mustcontain('1 file changed: 5 inserted, 1 deleted') |
|
139 | for file_changes in [(1, 5, 1), (12, 236, 22), (21, 943, 288)]: | |
134 | response.mustcontain('12 files changed: 236 inserted, 22 deleted') |
|
140 | compare_page.contains_change_summary(*file_changes) | |
135 | response.mustcontain('21 files changed: 943 inserted, 288 deleted') |
|
|||
136 | elif backend.alias == 'git': |
|
141 | elif backend.alias == 'git': | |
137 | response.mustcontain('new file 100644') |
|
142 | response.mustcontain('new file 100644') | |
138 | response.mustcontain('12 files changed: 222 inserted, 20 deleted') |
|
143 | for file_changes in [(12, 222, 20), (20, 941, 286)]: | |
139 | response.mustcontain('20 files changed: 941 inserted, 286 deleted') |
|
144 | compare_page.contains_change_summary(*file_changes) | |
140 | else: |
|
145 | else: | |
141 | response.mustcontain('new file 100644') |
|
146 | response.mustcontain('new file 100644') | |
142 | response.mustcontain('12 files changed: 222 inserted, 20 deleted') |
|
147 | for file_changes in [(12, 222, 20), (21, 943, 288)]: | |
143 | response.mustcontain('21 files changed: 943 inserted, 288 deleted') |
|
148 | compare_page.contains_change_summary(*file_changes) | |
144 |
|
149 | |||
145 | # files op files |
|
150 | # files op files | |
146 | response.mustcontain('File not present at commit: %s' % |
|
151 | response.mustcontain('File not present at commit: %s' % _shorten_commit_id(commit_ids[1])) | |
147 | _shorten_commit_id(commit_ids[1])) |
|
|||
148 | response.mustcontain('Added docstrings to vcs.cli') # commit msg |
|
152 | response.mustcontain('Added docstrings to vcs.cli') # commit msg | |
149 | response.mustcontain('Changed theme to ADC theme') # commit msg |
|
153 | response.mustcontain('Changed theme to ADC theme') # commit msg | |
150 |
|
154 | |||
@@ -176,16 +180,21 b' class TestRepoCommitView(object):' | |||||
176 | response.mustcontain('File not present at commit: %s' % |
|
180 | response.mustcontain('File not present at commit: %s' % | |
177 | _shorten_commit_id(commit_ids[1])) |
|
181 | _shorten_commit_id(commit_ids[1])) | |
178 |
|
182 | |||
|
183 | compare_page = ComparePage(response) | |||
|
184 | ||||
179 | # svn is special |
|
185 | # svn is special | |
180 | if backend.alias == 'svn': |
|
186 | if backend.alias == 'svn': | |
181 | response.mustcontain('new file 10644') |
|
187 | response.mustcontain('new file 10644') | |
182 | response.mustcontain('32 files changed: 1179 inserted, 310 deleted') |
|
188 | file_changes = (32, 1179, 310) | |
|
189 | compare_page.contains_change_summary(*file_changes) | |||
183 | elif backend.alias == 'git': |
|
190 | elif backend.alias == 'git': | |
184 | response.mustcontain('new file 100644') |
|
191 | response.mustcontain('new file 100644') | |
185 | response.mustcontain('31 files changed: 1163 inserted, 306 deleted') |
|
192 | file_changes = (31, 1163, 306) | |
|
193 | compare_page.contains_change_summary(*file_changes) | |||
186 | else: |
|
194 | else: | |
187 | response.mustcontain('new file 100644') |
|
195 | response.mustcontain('new file 100644') | |
188 | response.mustcontain('32 files changed: 1165 inserted, 308 deleted') |
|
196 | file_changes = (32, 1165, 308) | |
|
197 | compare_page.contains_change_summary(*file_changes) | |||
189 |
|
198 | |||
190 | response.mustcontain('Added docstrings to vcs.cli') # commit msg |
|
199 | response.mustcontain('Added docstrings to vcs.cli') # commit msg | |
191 | response.mustcontain('Changed theme to ADC theme') # commit msg |
|
200 | response.mustcontain('Changed theme to ADC theme') # commit msg | |
@@ -313,6 +322,6 b' Added a symlink' | |||||
313 |
|
322 | |||
314 | # right pane diff menus |
|
323 | # right pane diff menus | |
315 | if right_menu: |
|
324 | if right_menu: | |
316 |
for elem in ['Hide whitespace changes', 'Toggle |
|
325 | for elem in ['Hide whitespace changes', 'Toggle wide diff', | |
317 | 'Show full context diff']: |
|
326 | 'Show full context diff']: | |
318 | response.mustcontain(elem) |
|
327 | response.mustcontain(elem) |
@@ -623,8 +623,8 b' class ComparePage(AssertResponse):' | |||||
623 |
|
623 | |||
624 | def contains_change_summary(self, files_changed, inserted, deleted): |
|
624 | def contains_change_summary(self, files_changed, inserted, deleted): | |
625 | template = ( |
|
625 | template = ( | |
626 |
|
|
626 | '{files_changed} file{plural} changed: ' | |
627 |
"{inserted} inserted, {deleted} deleted |
|
627 | '<span class="op-added">{inserted} inserted</span>, <span class="op-deleted">{deleted} deleted</span>') | |
628 | self.response.mustcontain(template.format( |
|
628 | self.response.mustcontain(template.format( | |
629 | files_changed=files_changed, |
|
629 | files_changed=files_changed, | |
630 | plural="s" if files_changed > 1 else "", |
|
630 | plural="s" if files_changed > 1 else "", |
@@ -20,6 +20,7 b'' | |||||
20 |
|
20 | |||
21 | import pytest |
|
21 | import pytest | |
22 |
|
22 | |||
|
23 | from rhodecode.apps.repository.tests.test_repo_compare import ComparePage | |||
23 | from rhodecode.lib.vcs import nodes |
|
24 | from rhodecode.lib.vcs import nodes | |
24 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
25 | from rhodecode.lib.vcs.backends.base import EmptyCommit | |
25 | from rhodecode.tests.fixture import Fixture |
|
26 | from rhodecode.tests.fixture import Fixture | |
@@ -49,18 +50,18 b' class TestSideBySideDiff(object):' | |||||
49 | 'hg': { |
|
50 | 'hg': { | |
50 | 'commits': ['25d7e49c18b159446cadfa506a5cf8ad1cb04067', |
|
51 | 'commits': ['25d7e49c18b159446cadfa506a5cf8ad1cb04067', | |
51 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], |
|
52 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], | |
52 |
'changes': |
|
53 | 'changes': (21, 943, 288), | |
53 | }, |
|
54 | }, | |
54 | 'git': { |
|
55 | 'git': { | |
55 | 'commits': ['6fc9270775aaf5544c1deb014f4ddd60c952fcbb', |
|
56 | 'commits': ['6fc9270775aaf5544c1deb014f4ddd60c952fcbb', | |
56 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], |
|
57 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], | |
57 |
'changes': |
|
58 | 'changes': (20, 941, 286), | |
58 | }, |
|
59 | }, | |
59 |
|
60 | |||
60 | 'svn': { |
|
61 | 'svn': { | |
61 | 'commits': ['336', |
|
62 | 'commits': ['336', | |
62 | '337'], |
|
63 | '337'], | |
63 |
'changes': |
|
64 | 'changes': (21, 943, 288), | |
64 | }, |
|
65 | }, | |
65 | } |
|
66 | } | |
66 |
|
67 | |||
@@ -79,7 +80,8 b' class TestSideBySideDiff(object):' | |||||
79 | params=dict(target_repo=backend.repo_name, diffmode='sidebyside') |
|
80 | params=dict(target_repo=backend.repo_name, diffmode='sidebyside') | |
80 | )) |
|
81 | )) | |
81 |
|
82 | |||
82 | response.mustcontain(file_changes) |
|
83 | compare_page = ComparePage(response) | |
|
84 | compare_page.contains_change_summary(*file_changes) | |||
83 | response.mustcontain('Expand 1 commit') |
|
85 | response.mustcontain('Expand 1 commit') | |
84 |
|
86 | |||
85 | def test_diff_sidebyside_two_commits(self, app, backend): |
|
87 | def test_diff_sidebyside_two_commits(self, app, backend): | |
@@ -87,18 +89,18 b' class TestSideBySideDiff(object):' | |||||
87 | 'hg': { |
|
89 | 'hg': { | |
88 | 'commits': ['4fdd71e9427417b2e904e0464c634fdee85ec5a7', |
|
90 | 'commits': ['4fdd71e9427417b2e904e0464c634fdee85ec5a7', | |
89 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], |
|
91 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], | |
90 |
'changes': |
|
92 | 'changes': (32, 1165, 308), | |
91 | }, |
|
93 | }, | |
92 | 'git': { |
|
94 | 'git': { | |
93 | 'commits': ['f5fbf9cfd5f1f1be146f6d3b38bcd791a7480c13', |
|
95 | 'commits': ['f5fbf9cfd5f1f1be146f6d3b38bcd791a7480c13', | |
94 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], |
|
96 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], | |
95 |
'changes': |
|
97 | 'changes': (31, 1163, 306), | |
96 | }, |
|
98 | }, | |
97 |
|
99 | |||
98 | 'svn': { |
|
100 | 'svn': { | |
99 | 'commits': ['335', |
|
101 | 'commits': ['335', | |
100 | '337'], |
|
102 | '337'], | |
101 |
'changes': |
|
103 | 'changes': (32, 1179, 310), | |
102 | }, |
|
104 | }, | |
103 | } |
|
105 | } | |
104 |
|
106 | |||
@@ -117,7 +119,9 b' class TestSideBySideDiff(object):' | |||||
117 | params=dict(target_repo=backend.repo_name, diffmode='sidebyside') |
|
119 | params=dict(target_repo=backend.repo_name, diffmode='sidebyside') | |
118 | )) |
|
120 | )) | |
119 |
|
121 | |||
120 | response.mustcontain(file_changes) |
|
122 | compare_page = ComparePage(response) | |
|
123 | compare_page.contains_change_summary(*file_changes) | |||
|
124 | ||||
121 | response.mustcontain('Expand 2 commits') |
|
125 | response.mustcontain('Expand 2 commits') | |
122 |
|
126 | |||
123 | @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)') |
|
127 | @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)') | |
@@ -152,7 +156,7 b' class TestSideBySideDiff(object):' | |||||
152 | 'r%s:%s...r%s:%s' % ( |
|
156 | 'r%s:%s...r%s:%s' % ( | |
153 | commit1.idx, commit1.short_id, commit2.idx, commit2.short_id)) |
|
157 | commit1.idx, commit1.short_id, commit2.idx, commit2.short_id)) | |
154 |
|
158 | |||
155 |
response.mustcontain( |
|
159 | response.mustcontain(f_path) | |
156 |
|
160 | |||
157 | @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)') |
|
161 | @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)') | |
158 | def test_diff_side_by_side_from_0_commit_with_file_filter(self, app, backend, backend_stub): |
|
162 | def test_diff_side_by_side_from_0_commit_with_file_filter(self, app, backend, backend_stub): | |
@@ -186,7 +190,7 b' class TestSideBySideDiff(object):' | |||||
186 | 'r%s:%s...r%s:%s' % ( |
|
190 | 'r%s:%s...r%s:%s' % ( | |
187 | commit1.idx, commit1.short_id, commit2.idx, commit2.short_id)) |
|
191 | commit1.idx, commit1.short_id, commit2.idx, commit2.short_id)) | |
188 |
|
192 | |||
189 |
response.mustcontain( |
|
193 | response.mustcontain(f_path) | |
190 |
|
194 | |||
191 | def test_diff_side_by_side_with_empty_file(self, app, backend, backend_stub): |
|
195 | def test_diff_side_by_side_with_empty_file(self, app, backend, backend_stub): | |
192 | commits = [ |
|
196 | commits = [ | |
@@ -218,25 +222,25 b' class TestSideBySideDiff(object):' | |||||
218 | 'r%s:%s...r%s:%s' % ( |
|
222 | 'r%s:%s...r%s:%s' % ( | |
219 | commit2.idx, commit2.short_id, commit3.idx, commit3.short_id)) |
|
223 | commit2.idx, commit2.short_id, commit3.idx, commit3.short_id)) | |
220 |
|
224 | |||
221 |
response.mustcontain( |
|
225 | response.mustcontain(f_path) | |
222 |
|
226 | |||
223 | def test_diff_sidebyside_two_commits_with_file_filter(self, app, backend): |
|
227 | def test_diff_sidebyside_two_commits_with_file_filter(self, app, backend): | |
224 | commit_id_range = { |
|
228 | commit_id_range = { | |
225 | 'hg': { |
|
229 | 'hg': { | |
226 | 'commits': ['4fdd71e9427417b2e904e0464c634fdee85ec5a7', |
|
230 | 'commits': ['4fdd71e9427417b2e904e0464c634fdee85ec5a7', | |
227 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], |
|
231 | '603d6c72c46d953420c89d36372f08d9f305f5dd'], | |
228 |
'changes': |
|
232 | 'changes': (1, 3, 3) | |
229 | }, |
|
233 | }, | |
230 | 'git': { |
|
234 | 'git': { | |
231 | 'commits': ['f5fbf9cfd5f1f1be146f6d3b38bcd791a7480c13', |
|
235 | 'commits': ['f5fbf9cfd5f1f1be146f6d3b38bcd791a7480c13', | |
232 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], |
|
236 | '03fa803d7e9fb14daa9a3089e0d1494eda75d986'], | |
233 |
'changes': |
|
237 | 'changes': (1, 3, 3) | |
234 | }, |
|
238 | }, | |
235 |
|
239 | |||
236 | 'svn': { |
|
240 | 'svn': { | |
237 | 'commits': ['335', |
|
241 | 'commits': ['335', | |
238 | '337'], |
|
242 | '337'], | |
239 |
'changes': |
|
243 | 'changes': (1, 3, 3) | |
240 | }, |
|
244 | }, | |
241 | } |
|
245 | } | |
242 | f_path = 'docs/conf.py' |
|
246 | f_path = 'docs/conf.py' | |
@@ -256,4 +260,6 b' class TestSideBySideDiff(object):' | |||||
256 | )) |
|
260 | )) | |
257 |
|
261 | |||
258 | response.mustcontain('Expand 2 commits') |
|
262 | response.mustcontain('Expand 2 commits') | |
259 | response.mustcontain(file_changes) |
|
263 | ||
|
264 | compare_page = ComparePage(response) | |||
|
265 | compare_page.contains_change_summary(*file_changes) |
@@ -23,6 +23,7 b' import os' | |||||
23 | import mock |
|
23 | import mock | |
24 | import pytest |
|
24 | import pytest | |
25 |
|
25 | |||
|
26 | from rhodecode.apps.repository.tests.test_repo_compare import ComparePage | |||
26 | from rhodecode.apps.repository.views.repo_files import RepoFilesView |
|
27 | from rhodecode.apps.repository.views.repo_files import RepoFilesView | |
27 | from rhodecode.lib import helpers as h |
|
28 | from rhodecode.lib import helpers as h | |
28 | from rhodecode.lib.compat import OrderedDict |
|
29 | from rhodecode.lib.compat import OrderedDict | |
@@ -617,7 +618,10 b' class TestFilesDiff(object):' | |||||
617 | # use redirect since this is OLD view redirecting to compare page |
|
618 | # use redirect since this is OLD view redirecting to compare page | |
618 | response = response.follow() |
|
619 | response = response.follow() | |
619 | response.mustcontain('Expand 1 commit') |
|
620 | response.mustcontain('Expand 1 commit') | |
620 | response.mustcontain('1 file changed: 0 inserted, 0 deleted') |
|
621 | file_changes = (1, 0, 0) | |
|
622 | ||||
|
623 | compare_page = ComparePage(response) | |||
|
624 | compare_page.contains_change_summary(*file_changes) | |||
621 |
|
625 | |||
622 | if backend.alias == 'svn': |
|
626 | if backend.alias == 'svn': | |
623 | response.mustcontain('new file 10644') |
|
627 | response.mustcontain('new file 10644') |
General Comments 0
You need to be logged in to leave comments.
Login now