##// END OF EJS Templates
Added tests for archival, cleaned changelog test from prints
marcink -
r873:386fe4ce beta
parent child Browse files
Show More
@@ -6,7 +6,6 b' class TestChangelogController(TestContro'
6 6 self.log_user()
7 7 response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO))
8 8
9 print response.body
10 9 assert """<div id="chg_20" class="container">""" in response.body, 'wrong info about number of changes'
11 10 assert """<div class="date">commit 154: 5e204e7583b9@2010-08-10 01:18:46</div>""" in response.body , 'no info on this commit'
12 11 assert """Small update at simplevcs app""" in response.body, 'missing info about commit message'
@@ -24,7 +23,6 b' class TestChangelogController(TestContro'
24 23 response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':6})
25 24
26 25 # Test response after pagination...
27 print response.body
28 26 assert """<div class="date">commit 64: 46ad32a4f974@2010-04-20 00:33:21</div>"""in response.body, 'wrong info about commit 64'
29 27 assert """<span class="removed tooltip" tooltip_title="removed: docs/api.rst">1</span>"""in response.body, 'wrong info about number of removed'
30 28 assert """<span class="changed tooltip" tooltip_title="changed: .hgignore<br/> README.rst<br/> docs/conf.py<br/> docs/index.rst<br/> setup.py<br/> tests/test_hg.py<br/> tests/test_nodes.py<br/> vcs/__init__.py<br/> vcs/backends/__init__.py<br/> vcs/backends/base.py<br/> vcs/backends/hg.py<br/> vcs/nodes.py<br/> vcs/utils/__init__.py">13</span>"""in response.body, 'wrong info about number of changes'
@@ -1,5 +1,11 b''
1 1 from rhodecode.tests import *
2 2
3 ARCHIVE_SPECS = {
4 '.tar.bz2': ('application/x-tar', 'tbz2', ''),
5 '.tar.gz': ('application/x-tar', 'tgz', ''),
6 '.zip': ('application/zip', 'zip', ''),
7 }
8
3 9 class TestFilesController(TestController):
4 10
5 11 def test_index(self):
@@ -188,3 +194,48 b' removed extra unicode conversion in diff'
188 194 </optgroup>""" in response.body, 'missing or wrong history in annotation'
189 195
190 196 assert """<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""" in response.body, 'missing or wrong branch info'
197
198
199
200 def test_archival(self):
201 self.log_user()
202
203 for arch_ext, info in ARCHIVE_SPECS.items():
204 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
205 filename = '%s-%s' % (HG_REPO, fname)
206
207 response = self.app.get(url(controller='files', action='archivefile',
208 repo_name=HG_REPO,
209 fname=fname))
210
211 assert response.status == '200 OK', 'wrong response code'
212 assert response.response._headers.items() == [('Pragma', 'no-cache'),
213 ('Cache-Control', 'no-cache'),
214 ('Content-Type', '%s; charset=utf-8' % info[0]),
215 ('Content-Disposition', 'attachment; filename=%s' % filename), ], 'wrong headers'
216
217 def test_archival_wrong_ext(self):
218 self.log_user()
219
220 for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']:
221 fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
222
223 response = self.app.get(url(controller='files', action='archivefile',
224 repo_name=HG_REPO,
225 fname=fname))
226 assert 'Unknown archive type' in response.body
227
228
229 def test_archival_wrong_revision(self):
230 self.log_user()
231
232 for rev in ['00x000000', 'tar', 'wrong', '@##$@$424213232', '232dffcd']:
233 fname = '%s.zip' % rev
234
235 response = self.app.get(url(controller='files', action='archivefile',
236 repo_name=HG_REPO,
237 fname=fname))
238 assert 'Unknown revision' in response.body
239
240
241
General Comments 0
You need to be logged in to leave comments. Login now