Ejemplo n.º 1
0
    def test_call_fault(self):
        class MyException(object):
            status_int = 415
            explanation = 'test'

        my_exceptions = MyException()
        my_fault = wsgi.Fault(exception=my_exceptions)
        request = wsgi.Request.blank(
            "/", method='POST', headers={'Content-Type': "unknow"})
        response = my_fault(request)
        self.assertEqual(415, response.status_int)
Ejemplo n.º 2
0
    def test_call_fault(self):
        class MyException(object):
            code = 415
            explanation = 'test'

        my_exception = MyException()
        converted_exp = exception.ConvertedException(
            code=my_exception.code, explanation=my_exception.explanation)
        my_fault = wsgi.Fault(converted_exp)
        req = wsgi.Request.blank("/",
                                 method='POST',
                                 headers={'Content-Type': "unknow"})
        response = my_fault(req)
        self.assertEqual(415, response.status_int)