|
| 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 ItemAssignmentTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_create_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.numbers.v2.regulatory_compliance \ |
| 22 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 23 | + .item_assignments.create(object_sid="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
| 24 | + |
| 25 | + values = {'ObjectSid': "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", } |
| 26 | + |
| 27 | + self.holodeck.assert_has_request(Request( |
| 28 | + 'post', |
| 29 | + 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments', |
| 30 | + data=values, |
| 31 | + )) |
| 32 | + |
| 33 | + def test_create_response(self): |
| 34 | + self.holodeck.mock(Response( |
| 35 | + 201, |
| 36 | + ''' |
| 37 | + { |
| 38 | + "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 39 | + "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 40 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 41 | + "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 42 | + "date_created": "2019-07-31T02:34:41Z", |
| 43 | + "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 44 | + } |
| 45 | + ''' |
| 46 | + )) |
| 47 | + |
| 48 | + actual = self.client.numbers.v2.regulatory_compliance \ |
| 49 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 50 | + .item_assignments.create(object_sid="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
| 51 | + |
| 52 | + self.assertIsNotNone(actual) |
| 53 | + |
| 54 | + def test_list_request(self): |
| 55 | + self.holodeck.mock(Response(500, '')) |
| 56 | + |
| 57 | + with self.assertRaises(TwilioException): |
| 58 | + self.client.numbers.v2.regulatory_compliance \ |
| 59 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 60 | + .item_assignments.list() |
| 61 | + |
| 62 | + self.holodeck.assert_has_request(Request( |
| 63 | + 'get', |
| 64 | + 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments', |
| 65 | + )) |
| 66 | + |
| 67 | + def test_read_empty_response(self): |
| 68 | + self.holodeck.mock(Response( |
| 69 | + 200, |
| 70 | + ''' |
| 71 | + { |
| 72 | + "results": [], |
| 73 | + "meta": { |
| 74 | + "page": 0, |
| 75 | + "page_size": 50, |
| 76 | + "first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", |
| 77 | + "previous_page_url": null, |
| 78 | + "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", |
| 79 | + "next_page_url": null, |
| 80 | + "key": "results" |
| 81 | + } |
| 82 | + } |
| 83 | + ''' |
| 84 | + )) |
| 85 | + |
| 86 | + actual = self.client.numbers.v2.regulatory_compliance \ |
| 87 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 88 | + .item_assignments.list() |
| 89 | + |
| 90 | + self.assertIsNotNone(actual) |
| 91 | + |
| 92 | + def test_read_full_response(self): |
| 93 | + self.holodeck.mock(Response( |
| 94 | + 200, |
| 95 | + ''' |
| 96 | + { |
| 97 | + "results": [ |
| 98 | + { |
| 99 | + "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 100 | + "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 101 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 102 | + "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 103 | + "date_created": "2019-07-31T02:34:41Z", |
| 104 | + "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 105 | + } |
| 106 | + ], |
| 107 | + "meta": { |
| 108 | + "page": 0, |
| 109 | + "page_size": 50, |
| 110 | + "first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", |
| 111 | + "previous_page_url": null, |
| 112 | + "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", |
| 113 | + "next_page_url": null, |
| 114 | + "key": "results" |
| 115 | + } |
| 116 | + } |
| 117 | + ''' |
| 118 | + )) |
| 119 | + |
| 120 | + actual = self.client.numbers.v2.regulatory_compliance \ |
| 121 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 122 | + .item_assignments.list() |
| 123 | + |
| 124 | + self.assertIsNotNone(actual) |
| 125 | + |
| 126 | + def test_fetch_request(self): |
| 127 | + self.holodeck.mock(Response(500, '')) |
| 128 | + |
| 129 | + with self.assertRaises(TwilioException): |
| 130 | + self.client.numbers.v2.regulatory_compliance \ |
| 131 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 132 | + .item_assignments(sid="BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() |
| 133 | + |
| 134 | + self.holodeck.assert_has_request(Request( |
| 135 | + 'get', |
| 136 | + 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments/BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
| 137 | + )) |
| 138 | + |
| 139 | + def test_fetch_response(self): |
| 140 | + self.holodeck.mock(Response( |
| 141 | + 200, |
| 142 | + ''' |
| 143 | + { |
| 144 | + "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 145 | + "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 146 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 147 | + "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 148 | + "date_created": "2019-07-31T02:34:41Z", |
| 149 | + "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 150 | + } |
| 151 | + ''' |
| 152 | + )) |
| 153 | + |
| 154 | + actual = self.client.numbers.v2.regulatory_compliance \ |
| 155 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 156 | + .item_assignments(sid="BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() |
| 157 | + |
| 158 | + self.assertIsNotNone(actual) |
| 159 | + |
| 160 | + def test_delete_request(self): |
| 161 | + self.holodeck.mock(Response(500, '')) |
| 162 | + |
| 163 | + with self.assertRaises(TwilioException): |
| 164 | + self.client.numbers.v2.regulatory_compliance \ |
| 165 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 166 | + .item_assignments(sid="BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() |
| 167 | + |
| 168 | + self.holodeck.assert_has_request(Request( |
| 169 | + 'delete', |
| 170 | + 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments/BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
| 171 | + )) |
| 172 | + |
| 173 | + def test_delete_response(self): |
| 174 | + self.holodeck.mock(Response( |
| 175 | + 204, |
| 176 | + None, |
| 177 | + )) |
| 178 | + |
| 179 | + actual = self.client.numbers.v2.regulatory_compliance \ |
| 180 | + .bundles(sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 181 | + .item_assignments(sid="BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() |
| 182 | + |
| 183 | + self.assertTrue(actual) |
0 commit comments