comparison rhodecode/tests/functional/test_summary.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents f81b1fded4c9
children 7e5f8c12a3fc
comparison
equal deleted inserted replaced
4115:8b7294a804a0 4116:ffd45b185016
1 # -*- coding: utf-8 -*-
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
1 from rhodecode.tests import * 15 from rhodecode.tests import *
2 from rhodecode.tests.fixture import Fixture 16 from rhodecode.tests.fixture import Fixture
3 from rhodecode.model.db import Repository 17 from rhodecode.model.db import Repository
4 from rhodecode.model.repo import RepoModel 18 from rhodecode.model.repo import RepoModel
5 from rhodecode.model.meta import Session 19 from rhodecode.model.meta import Session
17 action='index', 31 action='index',
18 repo_name=HG_REPO)) 32 repo_name=HG_REPO))
19 33
20 #repo type 34 #repo type
21 response.mustcontain( 35 response.mustcontain(
22 """<img style="margin-bottom:2px" class="icon" """ 36 """<i class="icon-hg" """
23 """title="Mercurial repository" alt="Mercurial repository" """
24 """src="/images/icons/hgicon.png"/>"""
25 ) 37 )
38 #public/private
26 response.mustcontain( 39 response.mustcontain(
27 """<img style="margin-bottom:2px" class="icon" """ 40 """<i class="icon-unlock-alt">"""
28 """title="Public repository" alt="Public """
29 """repository" src="/images/icons/public_repo.png"/>"""
30 )
31
32 #codes stats
33 self._enable_stats()
34
35 ScmModel().mark_for_invalidation(HG_REPO)
36 response = self.app.get(url(controller='summary', action='index',
37 repo_name=HG_REPO))
38 response.mustcontain(
39 """var data = [["py", {"count": 68, "desc": ["Python"]}], """
40 """["rst", {"count": 16, "desc": ["Rst"]}], """
41 """["css", {"count": 2, "desc": ["Css"]}], """
42 """["sh", {"count": 2, "desc": ["Bash"]}], """
43 """["yml", {"count": 1, "desc": ["Yaml"]}], """
44 """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}], """
45 """["js", {"count": 1, "desc": ["Javascript"]}], """
46 """["cfg", {"count": 1, "desc": ["Ini"]}], """
47 """["ini", {"count": 1, "desc": ["Ini"]}], """
48 """["html", {"count": 1, "desc": ["EvoqueHtml", "Html"]}]];"""
49 ) 41 )
50 42
51 # clone url... 43 # clone url...
52 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO) 44 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO)
53 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID) 45 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
59 action='index', 51 action='index',
60 repo_name=GIT_REPO)) 52 repo_name=GIT_REPO))
61 53
62 #repo type 54 #repo type
63 response.mustcontain( 55 response.mustcontain(
64 """<img style="margin-bottom:2px" class="icon" """ 56 """<i class="icon-git" """
65 """title="Git repository" alt="Git repository" """
66 """src="/images/icons/giticon.png"/>"""
67 ) 57 )
58 #public/private
68 response.mustcontain( 59 response.mustcontain(
69 """<img style="margin-bottom:2px" class="icon" """ 60 """<i class="icon-unlock-alt">"""
70 """title="Public repository" alt="Public """
71 """repository" src="/images/icons/public_repo.png"/>"""
72 ) 61 )
73 62
74 # clone url... 63 # clone url...
75 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO) 64 response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO)
76 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID) 65 response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
81 response = self.app.get(url(controller='summary', 70 response = self.app.get(url(controller='summary',
82 action='index', 71 action='index',
83 repo_name='_%s' % ID)) 72 repo_name='_%s' % ID))
84 73
85 #repo type 74 #repo type
86 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ 75 response.mustcontain(
87 """title="Mercurial repository" alt="Mercurial """ 76 """<i class="icon-hg" """
88 """repository" src="/images/icons/hgicon.png"/>""") 77 )
89 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ 78 #public/private
90 """title="Public repository" alt="Public """ 79 response.mustcontain(
91 """repository" src="/images/icons/public_repo.png"/>""") 80 """<i class="icon-unlock-alt">"""
81 )
92 82
93 def test_index_by_repo_having_id_path_in_name_hg(self): 83 def test_index_by_repo_having_id_path_in_name_hg(self):
94 self.log_user() 84 self.log_user()
95 fixture.create_repo(name='repo_1') 85 fixture.create_repo(name='repo_1')
96 response = self.app.get(url(controller='summary', 86 response = self.app.get(url(controller='summary',
109 response = self.app.get(url(controller='summary', 99 response = self.app.get(url(controller='summary',
110 action='index', 100 action='index',
111 repo_name='_%s' % ID)) 101 repo_name='_%s' % ID))
112 102
113 #repo type 103 #repo type
114 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ 104 response.mustcontain(
115 """title="Git repository" alt="Git """ 105 """<i class="icon-git" """
116 """repository" src="/images/icons/giticon.png"/>""") 106 )
117 response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ 107 #public/private
118 """title="Public repository" alt="Public """ 108 response.mustcontain(
119 """repository" src="/images/icons/public_repo.png"/>""") 109 """<i class="icon-unlock-alt">"""
110 )
120 111
121 def _enable_stats(self): 112 def _enable_stats(self, repo):
122 r = Repository.get_by_repo_name(HG_REPO) 113 r = Repository.get_by_repo_name(repo)
123 r.enable_statistics = True 114 r.enable_statistics = True
124 Session().add(r) 115 Session().add(r)
125 Session().commit() 116 Session().commit()
117
118 def test_index_trending(self):
119 self.log_user()
120 #codes stats
121 self._enable_stats(HG_REPO)
122
123 ScmModel().mark_for_invalidation(HG_REPO)
124 response = self.app.get(url(controller='summary', action='index',
125 repo_name=HG_REPO))
126 response.mustcontain(
127 '[["py", {"count": 68, "desc": ["Python"]}], '
128 '["rst", {"count": 16, "desc": ["Rst"]}], '
129 '["css", {"count": 2, "desc": ["Css"]}], '
130 '["sh", {"count": 2, "desc": ["Bash"]}], '
131 '["yml", {"count": 1, "desc": ["Yaml"]}], '
132 '["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}], '
133 '["js", {"count": 1, "desc": ["Javascript"]}], '
134 '["cfg", {"count": 1, "desc": ["Ini"]}], '
135 '["ini", {"count": 1, "desc": ["Ini"]}], '
136 '["html", {"count": 1, "desc": ["EvoqueHtml", "Html"]}]];'
137 )
138
139 def test_index_statistics(self):
140 self.log_user()
141 #codes stats
142 self._enable_stats(HG_REPO)
143
144 ScmModel().mark_for_invalidation(HG_REPO)
145 response = self.app.get(url(controller='summary', action='statistics',
146 repo_name=HG_REPO))
147
148 def test_index_trending_git(self):
149 self.log_user()
150 #codes stats
151 self._enable_stats(GIT_REPO)
152
153 ScmModel().mark_for_invalidation(GIT_REPO)
154 response = self.app.get(url(controller='summary', action='index',
155 repo_name=GIT_REPO))
156 response.mustcontain(
157 '[["py", {"count": 68, "desc": ["Python"]}], '
158 '["rst", {"count": 16, "desc": ["Rst"]}], '
159 '["css", {"count": 2, "desc": ["Css"]}], '
160 '["sh", {"count": 2, "desc": ["Bash"]}], '
161 '["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}], '
162 '["js", {"count": 1, "desc": ["Javascript"]}], '
163 '["cfg", {"count": 1, "desc": ["Ini"]}], '
164 '["ini", {"count": 1, "desc": ["Ini"]}], '
165 '["html", {"count": 1, "desc": ["EvoqueHtml", "Html"]}], '
166 '["bat", {"count": 1, "desc": ["Batch"]}]];'
167 )
168
169 def test_index_statistics_git(self):
170 self.log_user()
171 #codes stats
172 self._enable_stats(GIT_REPO)
173
174 ScmModel().mark_for_invalidation(GIT_REPO)
175 response = self.app.get(url(controller='summary', action='statistics',
176 repo_name=GIT_REPO))