예제 #1
0
파일: tests.py 프로젝트: amcgregor/wsgi2
 def test_simple_validation_error(self):
     def bad_app(environ,start_response):
         start_response("200 OK", ('Content-Type','text/plain'))
         return ["Hello, world!"]
     out, err = run_amock(validator(bad_app))
     self.failUnless(out.endswith(
         "A server error occurred.  Please contact the administrator."
     ))
     self.assertEqual(
         err.splitlines()[-2],
         "AssertionError: Headers (('Content-Type', 'text/plain')) must"
         " be of type list: <type 'tuple'>"
     )
예제 #2
0
파일: tests.py 프로젝트: amcgregor/wsgi2
 def test_validated_hello(self):
     out, err = run_amock(validator(hello_app))
     # the middleware doesn't support len(), so content-length isn't there
     self.check_hello(out, has_length=False)