wsgi/test/unittest_wsgi.py
author Christophe de Vienne <christophe@unlish.com>
Thu, 24 Jul 2014 20:53:21 +0200
changeset 9939 46a8ed48636f
child 9940 292f786009ba
permissions -rw-r--r--
[wsgi] Honor the 'CONTENT_TYPE' wsgi variable See http://legacy.python.org/dev/peps/pep-0333/#environ-variables Closes #4191812
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9939
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
import webtest.app
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     2
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     3
from cubicweb.devtools.webtest import CubicWebTestTC
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     4
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
from cubicweb.wsgi.request import CubicWebWsgiRequest
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     6
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     7
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
class WSGIAppTC(CubicWebTestTC):
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
    def test_content_type(self):
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    10
        r = webtest.app.TestRequest.blank('/', {'CONTENT_TYPE': 'text/plain'})
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    11
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    12
        req = CubicWebWsgiRequest(r.environ, self.vreg)
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    13
46a8ed48636f [wsgi] Honor the 'CONTENT_TYPE' wsgi variable
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    14
        self.assertEqual('text/plain', req.get_header('Content-Type'))