예제 #1
0
 def test_webserver_error_handler_contract_conflict(self,
                                                    mock_http_response,
                                                    mock_report_exception):
     exception = exceptions.ContractConflict()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(409, ANY)
예제 #2
0
 def test_webserver_error_handler_invalid_transaction_type(self, mock_http_response, mock_report_exception):
     exception = exceptions.InvalidTransactionType()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(400, ANY)
예제 #3
0
 def test_webserver_error_handler_insufficient_crypto(self, mock_http_response, mock_report_exception):
     exception = exceptions.NotEnoughCrypto()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(400, ANY)
예제 #4
0
 def test_webserver_error_handler_action_forbidden(self, mock_http_response, mock_report_exception):
     exception = exceptions.ActionForbidden()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(403, ANY)
예제 #5
0
 def test_webserver_error_handler_validation_exception(self, mock_http_response, mock_report_exception):
     exception = exceptions.ValidationException()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(400, ANY)
예제 #6
0
 def test_webserver_error_handler_not_found(self, mock_http_response, mock_report_exception):
     exception = exceptions.NotFound()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(404, ANY)
예제 #7
0
 def test_webserver_error_handler_unkown_error(self, mock_http_response, mock_report_exception):
     exception = RuntimeError()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_called_once_with(exception, "")
     mock_http_response.assert_called_once_with(500, ANY)
예제 #8
0
 def test_webserver_error_handler_bad_auth_error(self, mock_http_response, mock_report_exception):
     exception = exceptions.BadDockerAuth()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(400, ANY)
예제 #9
0
 def test_webserver_error_handler_not_accepting_verifications(self, mock_http_response, mock_report_exception):
     exception = exceptions.NotAcceptingVerifications()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(412, ANY)
예제 #10
0
 def test_webserver_error_handler_invalid_node_level(self, mock_http_response, mock_report_exception):
     exception = exceptions.InvalidNodeLevel()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(400, ANY)
예제 #11
0
 def test_webserver_error_handler_api_rate_limit(self, mock_http_response, mock_report_exception):
     exception = exceptions.APIRateLimitException()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(429, ANY)
예제 #12
0
 def test_webserver_error_handler_unauthorized_exception(self, mock_http_response, mock_report_exception):
     exception = exceptions.UnauthorizedException()
     helpers.webserver_error_handler(exception)
     mock_report_exception.assert_not_called()
     mock_http_response.assert_called_once_with(401, ANY)