Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
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)
Exemplo n.º 9
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)
Exemplo n.º 10
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)