How to use the messagebird.error.ValidationError function in messagebird

To help you get started, we’ve selected a few messagebird examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github messagebird / python-rest-api / tests / test_voice_webhook.py View on Github external
url = "https://example.com/"
        title = "FooBar"
        token = "FooBarToken"
        blank_string = '    '

        with self.assertRaises(ValidationError):
            VoiceCreateWebhookRequest(title=title)

        request = VoiceCreateWebhookRequest(url=url, title=title)

        self.assertEqual(url, request.url)
        self.assertEqual(title, request.title)
        self.assertEqual(None, request.token)

        request.url = url + url
        with self.assertRaises(ValidationError):
            request.url = blank_string
github messagebird / python-rest-api / tests / test_voice_webhook.py View on Github external
def test_voice_create_webhook_request_validation(self):
        url = "https://example.com/"
        title = "FooBar"
        token = "FooBarToken"
        blank_string = '    '

        with self.assertRaises(ValidationError):
            VoiceCreateWebhookRequest(title=title)

        request = VoiceCreateWebhookRequest(url=url, title=title)

        self.assertEqual(url, request.url)
        self.assertEqual(title, request.title)
        self.assertEqual(None, request.token)

        request.url = url + url
        with self.assertRaises(ValidationError):
            request.url = blank_string
github messagebird / python-rest-api / messagebird / client.py View on Github external
def voice_create_webhook(self, create_webhook_request):
        """ Create a voice webhook. """
        if create_webhook_request is None:
            raise ValidationError('Create request is empty')

        uri = VOICE_API_ROOT + '/' + VOICE_WEB_HOOKS_PATH
        return VoiceWebhook().load(self.request(uri, 'POST', create_webhook_request.__dict__(), VOICE_TYPE))
github messagebird / python-rest-api / messagebird / client.py View on Github external
def voice_update_webhook(self, id, update_webhook_request):
        """ Update a voice webhook. """
        if update_webhook_request is None:
            raise ValidationError('Update request is empty')

        uri = VOICE_API_ROOT + '/' + VOICE_WEB_HOOKS_PATH + '/' + str(id)
        return VoiceWebhook().load(self.request(uri, 'PUT', update_webhook_request.__dict__(), VOICE_TYPE))