##// END OF EJS Templates
tests: Adapt test to new mercurial version (3.8.2)...
johbo -
r140:fd19366c default
parent child Browse files
Show More
@@ -1,148 +1,148 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import pytest
21 import pytest
22
22
23 from rhodecode.tests import url
23 from rhodecode.tests import url
24 from rhodecode.tests.functional.test_compare import ComparePage
24 from rhodecode.tests.functional.test_compare import ComparePage
25
25
26
26
27 @pytest.mark.usefixtures("autologin_user", "app")
27 @pytest.mark.usefixtures("autologin_user", "app")
28 class TestCompareController:
28 class TestCompareController:
29
29
30 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
30 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
31 def test_compare_tag(self, backend):
31 def test_compare_tag(self, backend):
32 tag1 = 'v0.1.2'
32 tag1 = 'v0.1.2'
33 tag2 = 'v0.1.3'
33 tag2 = 'v0.1.3'
34 response = self.app.get(
34 response = self.app.get(
35 url(
35 url(
36 'compare_url',
36 'compare_url',
37 repo_name=backend.repo_name,
37 repo_name=backend.repo_name,
38 source_ref_type="tag",
38 source_ref_type="tag",
39 source_ref=tag1,
39 source_ref=tag1,
40 target_ref_type="tag",
40 target_ref_type="tag",
41 target_ref=tag2),
41 target_ref=tag2),
42 status=200)
42 status=200)
43
43
44 response.mustcontain('%s@%s' % (backend.repo_name, tag1))
44 response.mustcontain('%s@%s' % (backend.repo_name, tag1))
45 response.mustcontain('%s@%s' % (backend.repo_name, tag2))
45 response.mustcontain('%s@%s' % (backend.repo_name, tag2))
46
46
47 # outgoing changesets between tags
47 # outgoing changesets between tags
48 commit_indexes = {
48 commit_indexes = {
49 'git': [113] + range(115, 121),
49 'git': [113] + range(115, 121),
50 'hg': [112] + range(115, 121),
50 'hg': [112] + range(115, 121),
51 }
51 }
52 repo = backend.repo
52 repo = backend.repo
53 commits = (repo.get_commit(commit_idx=idx)
53 commits = (repo.get_commit(commit_idx=idx)
54 for idx in commit_indexes[backend.alias])
54 for idx in commit_indexes[backend.alias])
55 compare_page = ComparePage(response)
55 compare_page = ComparePage(response)
56 compare_page.contains_change_summary(11, 94, 64)
56 compare_page.contains_change_summary(11, 94, 64)
57 compare_page.contains_commits(commits)
57 compare_page.contains_commits(commits)
58
58
59 # files diff
59 # files diff
60 compare_page.contains_file_links_and_anchors([
60 compare_page.contains_file_links_and_anchors([
61 ('docs/api/utils/index.rst', 'a_c--1c5cf9e91c12'),
61 ('docs/api/utils/index.rst', 'a_c--1c5cf9e91c12'),
62 ('test_and_report.sh', 'a_c--e3305437df55'),
62 ('test_and_report.sh', 'a_c--e3305437df55'),
63 ('.hgignore', 'a_c--c8e92ef85cd1'),
63 ('.hgignore', 'a_c--c8e92ef85cd1'),
64 ('.hgtags', 'a_c--6e08b694d687'),
64 ('.hgtags', 'a_c--6e08b694d687'),
65 ('docs/api/index.rst', 'a_c--2c14b00f3393'),
65 ('docs/api/index.rst', 'a_c--2c14b00f3393'),
66 ('vcs/__init__.py', 'a_c--430ccbc82bdf'),
66 ('vcs/__init__.py', 'a_c--430ccbc82bdf'),
67 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
67 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
68 ('vcs/utils/__init__.py', 'a_c--ebb592c595c0'),
68 ('vcs/utils/__init__.py', 'a_c--ebb592c595c0'),
69 ('vcs/utils/annotate.py', 'a_c--7abc741b5052'),
69 ('vcs/utils/annotate.py', 'a_c--7abc741b5052'),
70 ('vcs/utils/diffs.py', 'a_c--2ef0ef106c56'),
70 ('vcs/utils/diffs.py', 'a_c--2ef0ef106c56'),
71 ('vcs/utils/lazy.py', 'a_c--3150cb87d4b7'),
71 ('vcs/utils/lazy.py', 'a_c--3150cb87d4b7'),
72 ])
72 ])
73
73
74 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
74 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
75 def test_compare_tag_branch(self, backend):
75 def test_compare_tag_branch(self, backend):
76 revisions = {
76 revisions = {
77 'hg': {
77 'hg': {
78 'tag': 'v0.2.0',
78 'tag': 'v0.2.0',
79 'branch': 'default',
79 'branch': 'default',
80 'response': (147, 5700, 10176)
80 'response': (147, 5701, 10177)
81 },
81 },
82 'git': {
82 'git': {
83 'tag': 'v0.2.2',
83 'tag': 'v0.2.2',
84 'branch': 'master',
84 'branch': 'master',
85 'response': (71, 2269, 3416)
85 'response': (71, 2269, 3416)
86 },
86 },
87 }
87 }
88
88
89 # Backend specific data, depends on the test repository for
89 # Backend specific data, depends on the test repository for
90 # functional tests.
90 # functional tests.
91 data = revisions[backend.alias]
91 data = revisions[backend.alias]
92
92
93 response = self.app.get(url(
93 response = self.app.get(url(
94 'compare_url',
94 'compare_url',
95 repo_name=backend.repo_name,
95 repo_name=backend.repo_name,
96 source_ref_type='branch',
96 source_ref_type='branch',
97 source_ref=data['branch'],
97 source_ref=data['branch'],
98 target_ref_type="tag",
98 target_ref_type="tag",
99 target_ref=data['tag'],
99 target_ref=data['tag'],
100 ))
100 ))
101
101
102 response.mustcontain('%s@%s' % (backend.repo_name, data['branch']))
102 response.mustcontain('%s@%s' % (backend.repo_name, data['branch']))
103 response.mustcontain('%s@%s' % (backend.repo_name, data['tag']))
103 response.mustcontain('%s@%s' % (backend.repo_name, data['tag']))
104 compare_page = ComparePage(response)
104 compare_page = ComparePage(response)
105 compare_page.contains_change_summary(*data['response'])
105 compare_page.contains_change_summary(*data['response'])
106
106
107 def test_index_branch(self, backend):
107 def test_index_branch(self, backend):
108 head_id = backend.default_head_id
108 head_id = backend.default_head_id
109 response = self.app.get(url(
109 response = self.app.get(url(
110 'compare_url',
110 'compare_url',
111 repo_name=backend.repo_name,
111 repo_name=backend.repo_name,
112 source_ref_type="branch",
112 source_ref_type="branch",
113 source_ref=head_id,
113 source_ref=head_id,
114 target_ref_type="branch",
114 target_ref_type="branch",
115 target_ref=head_id,
115 target_ref=head_id,
116 ))
116 ))
117
117
118 response.mustcontain('%s@%s' % (backend.repo_name, head_id))
118 response.mustcontain('%s@%s' % (backend.repo_name, head_id))
119
119
120 # branches are equal
120 # branches are equal
121 response.mustcontain('<p class="empty_data">No files</p>')
121 response.mustcontain('<p class="empty_data">No files</p>')
122 response.mustcontain('<p class="empty_data">No Commits</p>')
122 response.mustcontain('<p class="empty_data">No Commits</p>')
123
123
124 def test_compare_commits(self, backend):
124 def test_compare_commits(self, backend):
125 repo = backend.repo
125 repo = backend.repo
126 commit1 = repo.get_commit(commit_idx=0)
126 commit1 = repo.get_commit(commit_idx=0)
127 commit2 = repo.get_commit(commit_idx=1)
127 commit2 = repo.get_commit(commit_idx=1)
128
128
129 response = self.app.get(url(
129 response = self.app.get(url(
130 'compare_url',
130 'compare_url',
131 repo_name=backend.repo_name,
131 repo_name=backend.repo_name,
132 source_ref_type="rev",
132 source_ref_type="rev",
133 source_ref=commit1.raw_id,
133 source_ref=commit1.raw_id,
134 target_ref_type="rev",
134 target_ref_type="rev",
135 target_ref=commit2.raw_id,
135 target_ref=commit2.raw_id,
136 ))
136 ))
137 response.mustcontain('%s@%s' % (backend.repo_name, commit1.raw_id))
137 response.mustcontain('%s@%s' % (backend.repo_name, commit1.raw_id))
138 response.mustcontain('%s@%s' % (backend.repo_name, commit2.raw_id))
138 response.mustcontain('%s@%s' % (backend.repo_name, commit2.raw_id))
139 compare_page = ComparePage(response)
139 compare_page = ComparePage(response)
140
140
141 # files
141 # files
142 compare_page.contains_change_summary(1, 7, 0)
142 compare_page.contains_change_summary(1, 7, 0)
143
143
144 # outgoing commits between those commits
144 # outgoing commits between those commits
145 compare_page.contains_commits([commit2])
145 compare_page.contains_commits([commit2])
146 compare_page.contains_file_links_and_anchors([
146 compare_page.contains_file_links_and_anchors([
147 ('.hgignore', 'a_c--c8e92ef85cd1'),
147 ('.hgignore', 'a_c--c8e92ef85cd1'),
148 ])
148 ])
General Comments 0
You need to be logged in to leave comments. Login now