diff --git a/rhodecode/tests/functional/test_changelog.py b/rhodecode/tests/functional/test_changelog.py
--- a/rhodecode/tests/functional/test_changelog.py
+++ b/rhodecode/tests/functional/test_changelog.py
@@ -6,7 +6,6 @@ class TestChangelogController(TestContro
self.log_user()
response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO))
- print response.body
assert """
""" in response.body, 'wrong info about number of changes'
assert """
commit 154: 5e204e7583b9@2010-08-10 01:18:46
""" in response.body , 'no info on this commit'
assert """Small update at simplevcs app""" in response.body, 'missing info about commit message'
@@ -24,7 +23,6 @@ class TestChangelogController(TestContro
response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':6})
# Test response after pagination...
- print response.body
assert """
commit 64: 46ad32a4f974@2010-04-20 00:33:21
"""in response.body, 'wrong info about commit 64'
assert """
1"""in response.body, 'wrong info about number of removed'
assert """
13"""in response.body, 'wrong info about number of changes'
diff --git a/rhodecode/tests/functional/test_files.py b/rhodecode/tests/functional/test_files.py
--- a/rhodecode/tests/functional/test_files.py
+++ b/rhodecode/tests/functional/test_files.py
@@ -1,5 +1,11 @@
from rhodecode.tests import *
+ARCHIVE_SPECS = {
+ '.tar.bz2': ('application/x-tar', 'tbz2', ''),
+ '.tar.gz': ('application/x-tar', 'tgz', ''),
+ '.zip': ('application/zip', 'zip', ''),
+}
+
class TestFilesController(TestController):
def test_index(self):
@@ -188,3 +194,48 @@ removed extra unicode conversion in diff
""" in response.body, 'missing or wrong history in annotation'
assert """
branch: default""" in response.body, 'missing or wrong branch info'
+
+
+
+ def test_archival(self):
+ self.log_user()
+
+ for arch_ext, info in ARCHIVE_SPECS.items():
+ fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
+ filename = '%s-%s' % (HG_REPO, fname)
+
+ response = self.app.get(url(controller='files', action='archivefile',
+ repo_name=HG_REPO,
+ fname=fname))
+
+ assert response.status == '200 OK', 'wrong response code'
+ assert response.response._headers.items() == [('Pragma', 'no-cache'),
+ ('Cache-Control', 'no-cache'),
+ ('Content-Type', '%s; charset=utf-8' % info[0]),
+ ('Content-Disposition', 'attachment; filename=%s' % filename), ], 'wrong headers'
+
+ def test_archival_wrong_ext(self):
+ self.log_user()
+
+ for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']:
+ fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext
+
+ response = self.app.get(url(controller='files', action='archivefile',
+ repo_name=HG_REPO,
+ fname=fname))
+ assert 'Unknown archive type' in response.body
+
+
+ def test_archival_wrong_revision(self):
+ self.log_user()
+
+ for rev in ['00x000000', 'tar', 'wrong', '@##$@$424213232', '232dffcd']:
+ fname = '%s.zip' % rev
+
+ response = self.app.get(url(controller='files', action='archivefile',
+ repo_name=HG_REPO,
+ fname=fname))
+ assert 'Unknown revision' in response.body
+
+
+