|
| 1 | +# coding=utf-8 |
| 2 | +r""" |
| 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 BrandRegistrationTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_fetch_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.messaging.v1.brand_registrations("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() |
| 22 | + |
| 23 | + self.holodeck.assert_has_request(Request( |
| 24 | + 'get', |
| 25 | + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations/BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
| 26 | + )) |
| 27 | + |
| 28 | + def test_fetch_response(self): |
| 29 | + self.holodeck.mock(Response( |
| 30 | + 200, |
| 31 | + ''' |
| 32 | + { |
| 33 | + "sid": "BN0044409f7e067e279523808d267e2d85", |
| 34 | + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", |
| 35 | + "customer_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", |
| 36 | + "a2p_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", |
| 37 | + "date_created": "2021-01-27T14:18:35Z", |
| 38 | + "date_updated": "2021-01-27T14:18:36Z", |
| 39 | + "status": "IN_PROGRESS", |
| 40 | + "tcr_id": "BXXXXXX", |
| 41 | + "failure_reason": "Registration error", |
| 42 | + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" |
| 43 | + } |
| 44 | + ''' |
| 45 | + )) |
| 46 | + |
| 47 | + actual = self.client.messaging.v1.brand_registrations("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() |
| 48 | + |
| 49 | + self.assertIsNotNone(actual) |
| 50 | + |
| 51 | + def test_list_request(self): |
| 52 | + self.holodeck.mock(Response(500, '')) |
| 53 | + |
| 54 | + with self.assertRaises(TwilioException): |
| 55 | + self.client.messaging.v1.brand_registrations.list() |
| 56 | + |
| 57 | + self.holodeck.assert_has_request(Request( |
| 58 | + 'get', |
| 59 | + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations', |
| 60 | + )) |
| 61 | + |
| 62 | + def test_read_response(self): |
| 63 | + self.holodeck.mock(Response( |
| 64 | + 200, |
| 65 | + ''' |
| 66 | + { |
| 67 | + "meta": { |
| 68 | + "page": 0, |
| 69 | + "page_size": 50, |
| 70 | + "first_page_url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations?PageSize=50&Page=0", |
| 71 | + "previous_page_url": null, |
| 72 | + "next_page_url": null, |
| 73 | + "key": "data", |
| 74 | + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations?PageSize=50&Page=0" |
| 75 | + }, |
| 76 | + "data": [ |
| 77 | + { |
| 78 | + "sid": "BN0044409f7e067e279523808d267e2d85", |
| 79 | + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", |
| 80 | + "customer_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", |
| 81 | + "a2p_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", |
| 82 | + "date_created": "2021-01-27T14:18:35Z", |
| 83 | + "date_updated": "2021-01-27T14:18:36Z", |
| 84 | + "status": "IN_PROGRESS", |
| 85 | + "tcr_id": "BXXXXXX", |
| 86 | + "failure_reason": "Registration error", |
| 87 | + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" |
| 88 | + } |
| 89 | + ] |
| 90 | + } |
| 91 | + ''' |
| 92 | + )) |
| 93 | + |
| 94 | + actual = self.client.messaging.v1.brand_registrations.list() |
| 95 | + |
| 96 | + self.assertIsNotNone(actual) |
| 97 | + |
| 98 | + def test_create_request(self): |
| 99 | + self.holodeck.mock(Response(500, '')) |
| 100 | + |
| 101 | + with self.assertRaises(TwilioException): |
| 102 | + self.client.messaging.v1.brand_registrations.create(customer_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", a2p_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
| 103 | + |
| 104 | + values = { |
| 105 | + 'CustomerProfileBundleSid': "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", |
| 106 | + 'A2PProfileBundleSid': "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", |
| 107 | + } |
| 108 | + |
| 109 | + self.holodeck.assert_has_request(Request( |
| 110 | + 'post', |
| 111 | + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations', |
| 112 | + data=values, |
| 113 | + )) |
| 114 | + |
| 115 | + def test_create_response(self): |
| 116 | + self.holodeck.mock(Response( |
| 117 | + 201, |
| 118 | + ''' |
| 119 | + { |
| 120 | + "sid": "BN0044409f7e067e279523808d267e2d85", |
| 121 | + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", |
| 122 | + "customer_profile_bundle_sid": "BU0000009f7e067e279523808d267e2d90", |
| 123 | + "a2p_profile_bundle_sid": "BU1111109f7e067e279523808d267e2d85", |
| 124 | + "date_created": "2021-01-28T10:45:51Z", |
| 125 | + "date_updated": "2021-01-28T10:45:51Z", |
| 126 | + "status": "PENDING", |
| 127 | + "tcr_id": "BXXXXXX", |
| 128 | + "failure_reason": "Registration error", |
| 129 | + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" |
| 130 | + } |
| 131 | + ''' |
| 132 | + )) |
| 133 | + |
| 134 | + actual = self.client.messaging.v1.brand_registrations.create(customer_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", a2p_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
| 135 | + |
| 136 | + self.assertIsNotNone(actual) |
0 commit comments