Example #1
0
 def test_unexpected_exception_ec2_4xx(self):
     """Test response to unexpected EC2 exception with code = 400."""
     msg = "Test unexpected client failure."
     err = ec2.ec2_error_ex(TestClientExceptionEC2(msg), self.req,
                        unexpected=True)
     self._validate_ec2_error(err, TestClientExceptionEC2.code,
                              TestClientExceptionEC2.ec2_code, msg)
Example #2
0
 def test_unexpected_exception_ec2_4xx(self):
     """
     Test response to unexpected EC2 exception with code = 400.
     """
     msg = "Test unexpected client failure."
     err = ec2.ec2_error_ex(TestClientExceptionEC2(msg), self.req, unexpected=True)
     self._validate_ec2_error(err, TestClientExceptionEC2.code, TestClientExceptionEC2.ec2_code, msg)
Example #3
0
 def test_exception_ec2_4xx(self):
     """
     Test response to EC2 exception with code = 400.
     """
     msg = "Test client failure."
     err = ec2.ec2_error_ex(TestClientExceptionEC2(msg), self.req)
     self._validate_ec2_error(err, TestClientExceptionEC2.code, TestClientExceptionEC2.ec2_code, msg)
Example #4
0
 def test_exception_ec2_client(self):
     """
     Test response to client (400) EC2 exception.
     """
     msg = "Test client failure."
     err = ec2_error_ex(TestClientExceptionEC2(msg), self.req)
     self._validate_ec2_error(err, TestClientExceptionEC2.code,
                              TestClientExceptionEC2.ec2_code, msg)
Example #5
0
 def test_unexpected_exception_ec2_client(self):
     """
     Test response to an unexpected client (400) exception.
     """
     msg = "Test client failure."
     err = ec2_error_ex(TestClientExceptionEC2(msg), self.req,
                        unexpected=True)
     self._validate_ec2_error(err, TestClientExceptionEC2.code,
                              TestClientExceptionEC2.ec2_code, msg)
Example #6
0
    def test_exception_ec2_5xx(self):
        """Test response to EC2 exception with code = 500.

        Expected errors are treated as client ones even with 5xx code.
        """
        msg = "Test client failure with 5xx error code."
        err = ec2.ec2_error_ex(TestServerExceptionEC2(msg), self.req)
        self._validate_ec2_error(err, 400, TestServerExceptionEC2.ec2_code,
                                 msg)
Example #7
0
    def test_unexpected_exception_builtin(self):
        """Test response to builtin unexpected exception.

        Server exception messages (with code >= 500 or without code) should
        be filtered as they might contain sensitive information.
        """
        msg = "Test server failure."
        err = ec2.ec2_error_ex(RuntimeError(msg), self.req, unexpected=True)
        self._validate_ec2_error(err, 500, 'RuntimeError', unknown_msg=True)
Example #8
0
    def test_exception_ec2_5xx(self):
        """
        Test response to EC2 exception with code = 500.

        Expected errors are treated as client ones even with 5xx code.
        """
        msg = "Test client failure with 5xx error code."
        err = ec2.ec2_error_ex(TestServerExceptionEC2(msg), self.req)
        self._validate_ec2_error(err, 400, TestServerExceptionEC2.ec2_code, msg)
Example #9
0
    def test_unexpected_exception_builtin(self):
        """Test response to builtin unexpected exception.

        Server exception messages (with code >= 500 or without code) should
        be filtered as they might contain sensitive information.
        """
        msg = "Test server failure."
        err = ec2.ec2_error_ex(RuntimeError(msg), self.req, unexpected=True)
        self._validate_ec2_error(err, 500, 'RuntimeError', unknown_msg=True)
Example #10
0
    def test_unexpected_exception_ec2_5xx(self):
        """
        Test response to unexpected EC2 exception with code = 500.

        Server exception messages (with code >= 500 or without code) should
        be filtered as they might contain sensitive information.
        """
        msg = "Test server failure."
        err = ec2.ec2_error_ex(TestServerExceptionEC2(msg), self.req, unexpected=True)
        self._validate_ec2_error(err, TestServerExceptionEC2.code, TestServerExceptionEC2.ec2_code, unknown_msg=True)
Example #11
0
 def test_unexpected_exception_ec2_client(self):
     """
     Test response to an unexpected client (400) exception.
     """
     msg = "Test client failure."
     err = ec2_error_ex(TestClientExceptionEC2(msg),
                        self.req,
                        unexpected=True)
     self._validate_ec2_error(err, TestClientExceptionEC2.code,
                              TestClientExceptionEC2.ec2_code, msg)
Example #12
0
    def test_unexpected_exception_ec2_5xx(self):
        """Test response to unexpected EC2 exception with code = 500.

        Server exception messages (with code >= 500 or without code) should
        be filtered as they might contain sensitive information.
        """
        msg = "Test server failure."
        err = ec2.ec2_error_ex(TestServerExceptionEC2(msg), self.req,
                           unexpected=True)
        self._validate_ec2_error(err, TestServerExceptionEC2.code,
                                 TestServerExceptionEC2.ec2_code,
                                 unknown_msg=True)