changeset 1962:b0bb5cb08e44

add (failing) tests for HEAD requests
author Cheer Xiao <xiaqqaix@gmail.com>
date Sun, 10 Feb 2013 07:42:33 +0800
parents 597e051a6cd5
children f05af7eb6f50
files MoinMoin/apps/frontend/_tests/test_frontend.py
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/_tests/test_frontend.py	Sat Feb 09 17:26:13 2013 +0100
+++ b/MoinMoin/apps/frontend/_tests/test_frontend.py	Sun Feb 10 07:42:33 2013 +0800
@@ -26,14 +26,17 @@
             viewopts = {}
         if params is None:
             params = {}
-        print 'GET %s' % url_for(viewname, **viewopts)
+
         with self.app.test_client() as c:
-            rv = c.get(url_for(viewname, **viewopts), data=params)
-            assert rv.status == status
-            assert rv.headers['Content-Type'] in content_types
-            for item in data:
-                assert item in rv.data
-            return rv
+            for method in ['HEAD', 'GET']:
+                print '%s %s' % (method, url_for(viewname, **viewopts))
+                rv = c.open(url_for(viewname, **viewopts), method=method, data=params)
+                assert rv.status == status
+                assert rv.headers['Content-Type'] in content_types
+                if method == 'GET':
+                    for item in data:
+                        assert item in rv.data
+        return rv
 
     def _test_view_post(self, viewname, status='302 FOUND', content_types=('text/html; charset=utf-8', ), data=('<html>', '</html>'), form=None, viewopts=None):
         if viewopts is None: