Example #1
0
 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'>"
     )
Example #2
0
 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)