|
| 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 CompositionTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_fetch_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.video.v1.compositions(sid="CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() |
| 22 | + |
| 23 | + self.holodeck.assert_has_request(Request( |
| 24 | + 'get', |
| 25 | + 'https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', |
| 26 | + )) |
| 27 | + |
| 28 | + def test_fetch_response(self): |
| 29 | + self.holodeck.mock(Response( |
| 30 | + 200, |
| 31 | + ''' |
| 32 | + { |
| 33 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 34 | + "status": "completed", |
| 35 | + "date_created": "2015-07-30T20:00:00Z", |
| 36 | + "date_completed": "2015-07-30T20:01:33Z", |
| 37 | + "date_deleted": null, |
| 38 | + "sid": "CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 39 | + "audio_sources": [ |
| 40 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 41 | + ], |
| 42 | + "video_sources": [ |
| 43 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 44 | + ], |
| 45 | + "video_layout": "GRID", |
| 46 | + "resolution": "1280x720", |
| 47 | + "format": "webm", |
| 48 | + "bitrate": 64, |
| 49 | + "size": 4, |
| 50 | + "duration": 6, |
| 51 | + "url": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 52 | + "links": { |
| 53 | + "media": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" |
| 54 | + } |
| 55 | + } |
| 56 | + ''' |
| 57 | + )) |
| 58 | + |
| 59 | + actual = self.client.video.v1.compositions(sid="CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() |
| 60 | + |
| 61 | + self.assertIsNotNone(actual) |
| 62 | + |
| 63 | + def test_list_request(self): |
| 64 | + self.holodeck.mock(Response(500, '')) |
| 65 | + |
| 66 | + with self.assertRaises(TwilioException): |
| 67 | + self.client.video.v1.compositions.list() |
| 68 | + |
| 69 | + self.holodeck.assert_has_request(Request( |
| 70 | + 'get', |
| 71 | + 'https://video.twilio.com/v1/Compositions', |
| 72 | + )) |
| 73 | + |
| 74 | + def test_read_empty_response(self): |
| 75 | + self.holodeck.mock(Response( |
| 76 | + 200, |
| 77 | + ''' |
| 78 | + { |
| 79 | + "compositions": [], |
| 80 | + "meta": { |
| 81 | + "page": 0, |
| 82 | + "page_size": 50, |
| 83 | + "first_page_url": "https://video.twilio.com/v1/Compositions?PageSize=50&Page=0", |
| 84 | + "previous_page_url": null, |
| 85 | + "url": "https://video.twilio.com/v1/Compositions?PageSize=50&Page=0", |
| 86 | + "next_page_url": null, |
| 87 | + "key": "compositions" |
| 88 | + } |
| 89 | + } |
| 90 | + ''' |
| 91 | + )) |
| 92 | + |
| 93 | + actual = self.client.video.v1.compositions.list() |
| 94 | + |
| 95 | + self.assertIsNotNone(actual) |
| 96 | + |
| 97 | + def test_read_results_response(self): |
| 98 | + self.holodeck.mock(Response( |
| 99 | + 200, |
| 100 | + ''' |
| 101 | + { |
| 102 | + "compositions": [ |
| 103 | + { |
| 104 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 105 | + "status": "completed", |
| 106 | + "date_created": "2015-07-30T20:00:00Z", |
| 107 | + "date_completed": "2015-07-30T20:01:33Z", |
| 108 | + "date_deleted": null, |
| 109 | + "sid": "CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 110 | + "audio_sources": [ |
| 111 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 112 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" |
| 113 | + ], |
| 114 | + "video_sources": [], |
| 115 | + "video_layout": "GRID", |
| 116 | + "resolution": "1280x720", |
| 117 | + "format": "mp3", |
| 118 | + "bitrate": 16, |
| 119 | + "size": 55, |
| 120 | + "duration": 10, |
| 121 | + "url": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 122 | + "links": { |
| 123 | + "media": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" |
| 124 | + } |
| 125 | + } |
| 126 | + ], |
| 127 | + "meta": { |
| 128 | + "page": 0, |
| 129 | + "page_size": 50, |
| 130 | + "first_page_url": "https://video.twilio.com/v1/Compositions?PageSize=50&Page=0", |
| 131 | + "previous_page_url": null, |
| 132 | + "url": "https://video.twilio.com/v1/Compositions?PageSize=50&Page=0", |
| 133 | + "next_page_url": null, |
| 134 | + "key": "compositions" |
| 135 | + } |
| 136 | + } |
| 137 | + ''' |
| 138 | + )) |
| 139 | + |
| 140 | + actual = self.client.video.v1.compositions.list() |
| 141 | + |
| 142 | + self.assertIsNotNone(actual) |
| 143 | + |
| 144 | + def test_delete_request(self): |
| 145 | + self.holodeck.mock(Response(500, '')) |
| 146 | + |
| 147 | + with self.assertRaises(TwilioException): |
| 148 | + self.client.video.v1.compositions(sid="CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() |
| 149 | + |
| 150 | + self.holodeck.assert_has_request(Request( |
| 151 | + 'delete', |
| 152 | + 'https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', |
| 153 | + )) |
| 154 | + |
| 155 | + def test_delete_response(self): |
| 156 | + self.holodeck.mock(Response( |
| 157 | + 204, |
| 158 | + None, |
| 159 | + )) |
| 160 | + |
| 161 | + actual = self.client.video.v1.compositions(sid="CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() |
| 162 | + |
| 163 | + self.assertTrue(actual) |
| 164 | + |
| 165 | + def test_create_request(self): |
| 166 | + self.holodeck.mock(Response(500, '')) |
| 167 | + |
| 168 | + with self.assertRaises(TwilioException): |
| 169 | + self.client.video.v1.compositions.create() |
| 170 | + |
| 171 | + self.holodeck.assert_has_request(Request( |
| 172 | + 'post', |
| 173 | + 'https://video.twilio.com/v1/Compositions', |
| 174 | + )) |
| 175 | + |
| 176 | + def test_create_response(self): |
| 177 | + self.holodeck.mock(Response( |
| 178 | + 201, |
| 179 | + ''' |
| 180 | + { |
| 181 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 182 | + "status": "processing", |
| 183 | + "date_created": "2015-07-30T20:00:00Z", |
| 184 | + "date_completed": null, |
| 185 | + "date_deleted": null, |
| 186 | + "sid": "CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 187 | + "audio_sources": [ |
| 188 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 189 | + "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" |
| 190 | + ], |
| 191 | + "video_sources": [], |
| 192 | + "video_layout": "GRID", |
| 193 | + "resolution": "1280x720", |
| 194 | + "format": "mp3", |
| 195 | + "bitrate": 0, |
| 196 | + "size": 0, |
| 197 | + "duration": 1, |
| 198 | + "url": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 199 | + "links": { |
| 200 | + "media": "https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" |
| 201 | + } |
| 202 | + } |
| 203 | + ''' |
| 204 | + )) |
| 205 | + |
| 206 | + actual = self.client.video.v1.compositions.create() |
| 207 | + |
| 208 | + self.assertIsNotNone(actual) |
0 commit comments