##// END OF EJS Templates
tests: fixed some tests after sidebar introduction
marcink -
r4486:8b48fea3 default
parent child
Show More
@@ -619,7 +619,12 class ComparePage(AssertResponse):
619 self.contains_one_anchor(file_id)
619 self.contains_one_anchor(file_id)
620 diffblock = doc.cssselect('[data-f-path="%s"]' % filename)
620 diffblock = doc.cssselect('[data-f-path="%s"]' % filename)
621 assert len(diffblock) == 2
621 assert len(diffblock) == 2
622 assert len(diffblock[0].cssselect('a[href="#%s"]' % file_id)) == 1
622 for lnk in diffblock[0].cssselect('a'):
623 if 'permalink' in lnk.text:
624 assert '#{}'.format(file_id) in lnk.attrib['href']
625 break
626 else:
627 pytest.fail('Unable to find permalink')
623
628
624 def contains_change_summary(self, files_changed, inserted, deleted):
629 def contains_change_summary(self, files_changed, inserted, deleted):
625 template = (
630 template = (
@@ -150,9 +150,9 class TestPullrequestsView(object):
150 response = self.app.post(
150 response = self.app.post(
151 route_path('pullrequest_create', repo_name=source.repo_name),
151 route_path('pullrequest_create', repo_name=source.repo_name),
152 [
152 [
153 ('source_repo', source.repo_name),
153 ('source_repo', source_repo_name),
154 ('source_ref', source_ref),
154 ('source_ref', source_ref),
155 ('target_repo', target.repo_name),
155 ('target_repo', target_repo_name),
156 ('target_ref', target_ref),
156 ('target_ref', target_ref),
157 ('common_ancestor', commit_ids['initial-commit']),
157 ('common_ancestor', commit_ids['initial-commit']),
158 ('pullrequest_title', 'Title'),
158 ('pullrequest_title', 'Title'),
@@ -1110,16 +1110,17 class TestPullrequestsView(object):
1110
1110
1111 # source has ancestor - change - change-2
1111 # source has ancestor - change - change-2
1112 backend.pull_heads(source, heads=['change-2'])
1112 backend.pull_heads(source, heads=['change-2'])
1113 target_repo_name = target.repo_name
1113
1114
1114 # update PR
1115 # update PR
1115 self.app.post(
1116 self.app.post(
1116 route_path('pullrequest_update',
1117 route_path('pullrequest_update',
1117 repo_name=target.repo_name, pull_request_id=pull_request_id),
1118 repo_name=target_repo_name, pull_request_id=pull_request_id),
1118 params={'update_commits': 'true', 'csrf_token': csrf_token})
1119 params={'update_commits': 'true', 'csrf_token': csrf_token})
1119
1120
1120 response = self.app.get(
1121 response = self.app.get(
1121 route_path('pullrequest_show',
1122 route_path('pullrequest_show',
1122 repo_name=target.repo_name,
1123 repo_name=target_repo_name,
1123 pull_request_id=pull_request.pull_request_id))
1124 pull_request_id=pull_request.pull_request_id))
1124
1125
1125 assert response.status_int == 200
1126 assert response.status_int == 200
@@ -1166,10 +1167,11 class TestPullrequestsView(object):
1166 # source has ancestor - ancestor-new - change-rebased
1167 # source has ancestor - ancestor-new - change-rebased
1167 backend.pull_heads(target, heads=['ancestor-new'])
1168 backend.pull_heads(target, heads=['ancestor-new'])
1168 backend.pull_heads(source, heads=['change-rebased'])
1169 backend.pull_heads(source, heads=['change-rebased'])
1170 target_repo_name = target.repo_name
1169
1171
1170 # update PR
1172 # update PR
1171 url = route_path('pullrequest_update',
1173 url = route_path('pullrequest_update',
1172 repo_name=target.repo_name,
1174 repo_name=target_repo_name,
1173 pull_request_id=pull_request_id)
1175 pull_request_id=pull_request_id)
1174 self.app.post(url,
1176 self.app.post(url,
1175 params={'update_commits': 'true', 'csrf_token': csrf_token},
1177 params={'update_commits': 'true', 'csrf_token': csrf_token},
@@ -1183,7 +1185,7 class TestPullrequestsView(object):
1183
1185
1184 response = self.app.get(
1186 response = self.app.get(
1185 route_path('pullrequest_show',
1187 route_path('pullrequest_show',
1186 repo_name=target.repo_name,
1188 repo_name=target_repo_name,
1187 pull_request_id=pull_request.pull_request_id))
1189 pull_request_id=pull_request.pull_request_id))
1188 assert response.status_int == 200
1190 assert response.status_int == 200
1189 response.mustcontain('Pull request updated to')
1191 response.mustcontain('Pull request updated to')
@@ -1232,16 +1234,17 class TestPullrequestsView(object):
1232 vcsrepo = target.scm_instance()
1234 vcsrepo = target.scm_instance()
1233 vcsrepo.config.clear_section('hooks')
1235 vcsrepo.config.clear_section('hooks')
1234 vcsrepo.run_git_command(['reset', '--soft', 'HEAD~2'])
1236 vcsrepo.run_git_command(['reset', '--soft', 'HEAD~2'])
1237 target_repo_name = target.repo_name
1235
1238
1236 # update PR
1239 # update PR
1237 url = route_path('pullrequest_update',
1240 url = route_path('pullrequest_update',
1238 repo_name=target.repo_name,
1241 repo_name=target_repo_name,
1239 pull_request_id=pull_request_id)
1242 pull_request_id=pull_request_id)
1240 self.app.post(url,
1243 self.app.post(url,
1241 params={'update_commits': 'true', 'csrf_token': csrf_token},
1244 params={'update_commits': 'true', 'csrf_token': csrf_token},
1242 status=200)
1245 status=200)
1243
1246
1244 response = self.app.get(route_path('pullrequest_new', repo_name=target.repo_name))
1247 response = self.app.get(route_path('pullrequest_new', repo_name=target_repo_name))
1245 assert response.status_int == 200
1248 assert response.status_int == 200
1246 response.mustcontain('Pull request updated to')
1249 response.mustcontain('Pull request updated to')
1247 response.mustcontain('with 0 added, 0 removed commits.')
1250 response.mustcontain('with 0 added, 0 removed commits.')
@@ -1280,11 +1283,12 class TestPullrequestsView(object):
1280 # source has ancestor - ancestor-new - change-rebased
1283 # source has ancestor - ancestor-new - change-rebased
1281 backend.pull_heads(target, heads=['ancestor-new'])
1284 backend.pull_heads(target, heads=['ancestor-new'])
1282 backend.pull_heads(source, heads=['change-rebased'])
1285 backend.pull_heads(source, heads=['change-rebased'])
1286 target_repo_name = target.repo_name
1283
1287
1284 # update PR
1288 # update PR
1285 self.app.post(
1289 self.app.post(
1286 route_path('pullrequest_update',
1290 route_path('pullrequest_update',
1287 repo_name=target.repo_name, pull_request_id=pull_request_id),
1291 repo_name=target_repo_name, pull_request_id=pull_request_id),
1288 params={'update_commits': 'true', 'csrf_token': csrf_token},
1292 params={'update_commits': 'true', 'csrf_token': csrf_token},
1289 status=200)
1293 status=200)
1290
1294
@@ -1389,6 +1393,8 class TestPullrequestsView(object):
1389 pull_request = pr_util.create_pull_request(
1393 pull_request = pr_util.create_pull_request(
1390 commits, target_head='old-feature', source_head='new-feature',
1394 commits, target_head='old-feature', source_head='new-feature',
1391 revisions=['new-feature'], mergeable=True)
1395 revisions=['new-feature'], mergeable=True)
1396 pr_id = pull_request.pull_request_id
1397 target_repo_name = pull_request.target_repo.repo_name
1392
1398
1393 vcs = pr_util.source_repository.scm_instance()
1399 vcs = pr_util.source_repository.scm_instance()
1394 if backend.alias == 'git':
1400 if backend.alias == 'git':
@@ -1397,8 +1403,8 class TestPullrequestsView(object):
1397 vcs.strip(pr_util.commit_ids['new-feature'])
1403 vcs.strip(pr_util.commit_ids['new-feature'])
1398
1404
1399 url = route_path('pullrequest_update',
1405 url = route_path('pullrequest_update',
1400 repo_name=pull_request.target_repo.repo_name,
1406 repo_name=target_repo_name,
1401 pull_request_id=pull_request.pull_request_id)
1407 pull_request_id=pr_id)
1402 response = self.app.post(url,
1408 response = self.app.post(url,
1403 params={'update_commits': 'true',
1409 params={'update_commits': 'true',
1404 'csrf_token': csrf_token})
1410 'csrf_token': csrf_token})
@@ -1409,8 +1415,8 class TestPullrequestsView(object):
1409 # Make sure that after update, it won't raise 500 errors
1415 # Make sure that after update, it won't raise 500 errors
1410 response = self.app.get(route_path(
1416 response = self.app.get(route_path(
1411 'pullrequest_show',
1417 'pullrequest_show',
1412 repo_name=pr_util.target_repository.repo_name,
1418 repo_name=target_repo_name,
1413 pull_request_id=pull_request.pull_request_id))
1419 pull_request_id=pr_id))
1414
1420
1415 assert response.status_int == 200
1421 assert response.status_int == 200
1416 response.assert_response().element_contains(
1422 response.assert_response().element_contains(
General Comments 0
You need to be logged in to leave comments. Login now