|
| 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 import serialize |
| 12 | +from twilio.base.exceptions import TwilioException |
| 13 | +from twilio.http.response import Response |
| 14 | + |
| 15 | + |
| 16 | +class UsAppToPersonTestCase(IntegrationTestCase): |
| 17 | + |
| 18 | + def test_create_request(self): |
| 19 | + self.holodeck.mock(Response(500, '')) |
| 20 | + |
| 21 | + with self.assertRaises(TwilioException): |
| 22 | + self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 23 | + .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) |
| 24 | + |
| 25 | + values = { |
| 26 | + 'BrandRegistrationSid': "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", |
| 27 | + 'Description': "description", |
| 28 | + 'MessageSamples': serialize.map(['message_samples'], lambda e: e), |
| 29 | + 'UsAppToPersonUsecase': "us_app_to_person_usecase", |
| 30 | + 'HasEmbeddedLinks': True, |
| 31 | + 'HasEmbeddedPhone': True, |
| 32 | + } |
| 33 | + |
| 34 | + self.holodeck.assert_has_request(Request( |
| 35 | + 'post', |
| 36 | + 'https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Compliance/Usa2p', |
| 37 | + data=values, |
| 38 | + )) |
| 39 | + |
| 40 | + def test_create_response(self): |
| 41 | + self.holodeck.mock(Response( |
| 42 | + 201, |
| 43 | + ''' |
| 44 | + { |
| 45 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 46 | + "brand_registration_sid": "BNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 47 | + "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 48 | + "description": "Send marketing messages about sales and offers to opted in customers.", |
| 49 | + "message_samples": [ |
| 50 | + "EXPRESS: Denim Days Event is ON", |
| 51 | + "LAST CHANCE: Book your next flight for just 1 (ONE) EUR" |
| 52 | + ], |
| 53 | + "us_app_to_person_usecase": "MARKETING", |
| 54 | + "has_embedded_links": true, |
| 55 | + "has_embedded_phone": false, |
| 56 | + "status": "PENDING", |
| 57 | + "campaign_id": "CXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 58 | + "is_externally_registered": false, |
| 59 | + "rate_limits": { |
| 60 | + "att": { |
| 61 | + "mps": 600, |
| 62 | + "msg_class": "A" |
| 63 | + }, |
| 64 | + "tmobile": { |
| 65 | + "brand_tier": "TOP" |
| 66 | + } |
| 67 | + }, |
| 68 | + "date_created": "2021-02-18T14:48:52Z", |
| 69 | + "date_updated": "2021-02-18T14:48:52Z", |
| 70 | + "url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p" |
| 71 | + } |
| 72 | + ''' |
| 73 | + )) |
| 74 | + |
| 75 | + actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 76 | + .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) |
| 77 | + |
| 78 | + self.assertIsNotNone(actual) |
| 79 | + |
| 80 | + def test_delete_request(self): |
| 81 | + self.holodeck.mock(Response(500, '')) |
| 82 | + |
| 83 | + with self.assertRaises(TwilioException): |
| 84 | + self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 85 | + .us_app_to_person.delete() |
| 86 | + |
| 87 | + self.holodeck.assert_has_request(Request( |
| 88 | + 'delete', |
| 89 | + 'https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Compliance/Usa2p', |
| 90 | + )) |
| 91 | + |
| 92 | + def test_delete_response(self): |
| 93 | + self.holodeck.mock(Response( |
| 94 | + 204, |
| 95 | + None, |
| 96 | + )) |
| 97 | + |
| 98 | + actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 99 | + .us_app_to_person.delete() |
| 100 | + |
| 101 | + self.assertTrue(actual) |
| 102 | + |
| 103 | + def test_fetch_request(self): |
| 104 | + self.holodeck.mock(Response(500, '')) |
| 105 | + |
| 106 | + with self.assertRaises(TwilioException): |
| 107 | + self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 108 | + .us_app_to_person.fetch() |
| 109 | + |
| 110 | + self.holodeck.assert_has_request(Request( |
| 111 | + 'get', |
| 112 | + 'https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Compliance/Usa2p', |
| 113 | + )) |
| 114 | + |
| 115 | + def test_fetch_response(self): |
| 116 | + self.holodeck.mock(Response( |
| 117 | + 200, |
| 118 | + ''' |
| 119 | + { |
| 120 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 121 | + "brand_registration_sid": "BNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 122 | + "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 123 | + "description": "Send marketing messages about sales and offers to opted in customers.", |
| 124 | + "message_samples": [ |
| 125 | + "EXPRESS: Denim Days Event is ON", |
| 126 | + "LAST CHANCE: Book your next flight for just 1 (ONE) EUR" |
| 127 | + ], |
| 128 | + "us_app_to_person_usecase": "MARKETING", |
| 129 | + "has_embedded_links": true, |
| 130 | + "has_embedded_phone": false, |
| 131 | + "status": "PENDING", |
| 132 | + "campaign_id": "CXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 133 | + "is_externally_registered": false, |
| 134 | + "rate_limits": { |
| 135 | + "att": { |
| 136 | + "mps": 600, |
| 137 | + "msg_class": "A" |
| 138 | + }, |
| 139 | + "tmobile": { |
| 140 | + "brand_tier": "TOP" |
| 141 | + } |
| 142 | + }, |
| 143 | + "date_created": "2021-02-18T14:48:52Z", |
| 144 | + "date_updated": "2021-02-18T14:48:52Z", |
| 145 | + "url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p" |
| 146 | + } |
| 147 | + ''' |
| 148 | + )) |
| 149 | + |
| 150 | + actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 151 | + .us_app_to_person.fetch() |
| 152 | + |
| 153 | + self.assertIsNotNone(actual) |
0 commit comments