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