changeset 1064:113a8db22852 beta

file tests updates + extended the feed tests
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 19 Feb 2011 01:05:20 +0100
parents bbddef1e9ef2
children 5d676b6ab71c
files rhodecode/tests/functional/test_feed.py rhodecode/tests/functional/test_files.py
diffstat 2 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/tests/functional/test_feed.py	Sat Feb 19 00:49:08 2011 +0100
+++ b/rhodecode/tests/functional/test_feed.py	Sat Feb 19 01:05:20 2011 +0100
@@ -6,10 +6,17 @@
         self.log_user()
         response = self.app.get(url(controller='feed', action='rss',
                                     repo_name=HG_REPO))
-        # Test response...
+
+
+
+        assert response.content_type == "application/rss+xml"
+        assert """<rss version="2.0">""" in response
 
     def test_atom(self):
         self.log_user()
         response = self.app.get(url(controller='feed', action='atom',
                                     repo_name=HG_REPO))
-        # Test response...
\ No newline at end of file
+
+        assert response.content_type == """application/atom+xml"""
+        assert """<?xml version="1.0" encoding="utf-8"?>""" in response
+        assert """<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us">""" in response
--- a/rhodecode/tests/functional/test_files.py	Sat Feb 19 00:49:08 2011 +0100
+++ b/rhodecode/tests/functional/test_files.py	Sat Feb 19 01:05:20 2011 +0100
@@ -246,9 +246,9 @@
                                     repo_name=HG_REPO,
                                     revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
                                     f_path='vcs/nodes.py'))
-        #print response.body()
-        #assert False
-        #TODO: put in more
+
+        assert response.content_disposition == "attachment; filename=nodes.py"
+        assert response.content_type == "text/x-python"
 
     def test_raw_file_wrong_cs(self):
         self.log_user()
@@ -258,7 +258,7 @@
         response = self.app.get(url(controller='files', action='rawfile',
                                     repo_name=HG_REPO,
                                     revision=rev,
-                                    f_path='vcs/nodes.py'))
+                                    f_path=f_path))
 
         assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message'
         assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message'
@@ -276,7 +276,7 @@
         assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message'
 
     #==========================================================================
-    # RAW
+    # RAW RESPONSE - PLAIN
     #==========================================================================
     def test_raw_ok(self):
         self.log_user()
@@ -284,8 +284,8 @@
                                     repo_name=HG_REPO,
                                     revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
                                     f_path='vcs/nodes.py'))
-        #assert False
-        #TODO: put in more
+
+        assert response.content_type == "text/plain"
 
     def test_raw_wrong_cs(self):
         self.log_user()
@@ -295,9 +295,8 @@
         response = self.app.get(url(controller='files', action='raw',
                                     repo_name=HG_REPO,
                                     revision=rev,
-                                    f_path='vcs/nodes.py'))
+                                    f_path=f_path))
 
-        print response.session['flash'][0][1]
         assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message'
         assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message'