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