wsgi/test/unittest_wsgi.py
changeset 9940 292f786009ba
parent 9939 46a8ed48636f
child 9941 8dc1c96d29f1
equal deleted inserted replaced
9939:46a8ed48636f 9940:292f786009ba
     1 import webtest.app
     1 import webtest.app
       
     2 from StringIO import StringIO
     2 
     3 
     3 from cubicweb.devtools.webtest import CubicWebTestTC
     4 from cubicweb.devtools.webtest import CubicWebTestTC
     4 
     5 
     5 from cubicweb.wsgi.request import CubicWebWsgiRequest
     6 from cubicweb.wsgi.request import CubicWebWsgiRequest
     6 
     7 
    10         r = webtest.app.TestRequest.blank('/', {'CONTENT_TYPE': 'text/plain'})
    11         r = webtest.app.TestRequest.blank('/', {'CONTENT_TYPE': 'text/plain'})
    11 
    12 
    12         req = CubicWebWsgiRequest(r.environ, self.vreg)
    13         req = CubicWebWsgiRequest(r.environ, self.vreg)
    13 
    14 
    14         self.assertEqual('text/plain', req.get_header('Content-Type'))
    15         self.assertEqual('text/plain', req.get_header('Content-Type'))
       
    16 
       
    17     def test_content_body(self):
       
    18         r = webtest.app.TestRequest.blank('/', {
       
    19             'CONTENT_LENGTH': 12,
       
    20             'CONTENT_TYPE': 'text/plain',
       
    21             'wsgi.input': StringIO('some content')})
       
    22 
       
    23         req = CubicWebWsgiRequest(r.environ, self.vreg)
       
    24 
       
    25         self.assertEqual('some content', req.content.read())