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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)