|
| 1 | +# coding=utf-8 |
| 2 | +""" |
| 3 | +This code was generated by |
| 4 | +\ / _ _ _| _ _ |
| 5 | + | (_)\/(_)(_|\/| |(/_ v1.0.0 |
| 6 | + / / |
| 7 | +""" |
| 8 | + |
| 9 | +from tests import IntegrationTestCase |
| 10 | +from tests.holodeck import Request |
| 11 | +from twilio.base.exceptions import TwilioException |
| 12 | +from twilio.http.response import Response |
| 13 | + |
| 14 | + |
| 15 | +class ExportConfigurationTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_fetch_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.preview.bulk_exports.export_configuration(resource_type="resource_type").fetch() |
| 22 | + |
| 23 | + self.holodeck.assert_has_request(Request( |
| 24 | + 'get', |
| 25 | + 'https://preview.twilio.com/BulkExports/Exports/resource_type/Configuration', |
| 26 | + )) |
| 27 | + |
| 28 | + def test_fetch_response(self): |
| 29 | + self.holodeck.mock(Response( |
| 30 | + 200, |
| 31 | + ''' |
| 32 | + { |
| 33 | + "url": "https://preview.twilio.com/BulkExports/Exports/Calls/Configuration", |
| 34 | + "enabled": true, |
| 35 | + "webhook_url": "", |
| 36 | + "webhook_method": "", |
| 37 | + "resource_type": "Calls", |
| 38 | + "email": "" |
| 39 | + } |
| 40 | + ''' |
| 41 | + )) |
| 42 | + |
| 43 | + actual = self.client.preview.bulk_exports.export_configuration(resource_type="resource_type").fetch() |
| 44 | + |
| 45 | + self.assertIsNotNone(actual) |
| 46 | + |
| 47 | + def test_update_request(self): |
| 48 | + self.holodeck.mock(Response(500, '')) |
| 49 | + |
| 50 | + with self.assertRaises(TwilioException): |
| 51 | + self.client.preview.bulk_exports.export_configuration(resource_type="resource_type").update() |
| 52 | + |
| 53 | + self.holodeck.assert_has_request(Request( |
| 54 | + 'post', |
| 55 | + 'https://preview.twilio.com/BulkExports/Exports/resource_type/Configuration', |
| 56 | + )) |
| 57 | + |
| 58 | + def test_update_response(self): |
| 59 | + self.holodeck.mock(Response( |
| 60 | + 200, |
| 61 | + ''' |
| 62 | + { |
| 63 | + "url": "https://preview.twilio.com/BulkExports/Exports/Calls/Configuration", |
| 64 | + "enabled": true, |
| 65 | + |
| 66 | + "webhook_url": "", |
| 67 | + "resource_type": "Calls", |
| 68 | + "webhook_method": "" |
| 69 | + } |
| 70 | + ''' |
| 71 | + )) |
| 72 | + |
| 73 | + actual = self.client.preview.bulk_exports.export_configuration(resource_type="resource_type").update() |
| 74 | + |
| 75 | + self.assertIsNotNone(actual) |
0 commit comments