Ejemplo n.º 1
0
	def test_handler_500(self):
		"""
		A functional test for the WSGI handler.
		"""
		environ = test.generate_test_wsgi_environment()
		
		def check500(result):
			status, headers = result
			self.failUnlessEqual(status, '500 Internal Server Error', "App handler returned unexpected status, '%s'" % status)
		
		# Set up the proper host info
		environ['HTTP_HOST'] = '____basic-test-domain____:1234567'
		environ['SERVER_NAME'] = '____basic-test-domain____'
		environ['HTTP_PORT'] = '1234567'
		environ['REQUEST_URI'] = '/app-test/test-resource/this/is/a/long/path?query=some+query'
		
		# Test for exceptions
		d = defer.Deferred()
		environ['REQUEST_URI'] = '/app-test/test-resource/exception'
		app.handler(environ, lambda s,h: d.callback((s,h)))
		d.addCallback(check500)
Ejemplo n.º 2
0
def application(environ, start_response):
	return app.handler(environ, start_response)