devtools-request: transmit the headers keyword argument to the request class
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 16 Mar 2012 14:23:58 +0100
changeset 8318 e8a2fd7d9606
parent 8316 d5b1b75805dd
child 8320 cd2d332b3063
devtools-request: transmit the headers keyword argument to the request class Otherwise the headers kwargs end up in the form. This is very useful for testing publish logic related to http header (as cache).
devtools/testlib.py
--- a/devtools/testlib.py	Thu Mar 15 17:59:27 2012 +0100
+++ b/devtools/testlib.py	Fri Mar 16 14:23:58 2012 +0100
@@ -592,9 +592,9 @@
         return publisher
 
     requestcls = fake.FakeRequest
-    def request(self, rollbackfirst=False, url=None, **kwargs):
+    def request(self, rollbackfirst=False, url=None, headers={}, **kwargs):
         """return a web ui request"""
-        req = self.requestcls(self.vreg, url=url, form=kwargs)
+        req = self.requestcls(self.vreg, url=url, headers=headers, form=kwargs)
         if rollbackfirst:
             self.websession.cnx.rollback()
         req.set_session(self.websession)