|
| 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 MessageInteractionTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_create_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 22 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 23 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 24 | + .message_interactions.create() |
| 25 | + |
| 26 | + self.holodeck.assert_has_request(Request( |
| 27 | + 'post', |
| 28 | + 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions', |
| 29 | + )) |
| 30 | + |
| 31 | + def test_create_response(self): |
| 32 | + self.holodeck.mock(Response( |
| 33 | + 201, |
| 34 | + ''' |
| 35 | + { |
| 36 | + "service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 37 | + "data": "body", |
| 38 | + "date_created": "2015-07-30T20:00:00Z", |
| 39 | + "date_updated": "2015-07-30T20:00:00Z", |
| 40 | + "participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 41 | + "inbound_participant_sid": null, |
| 42 | + "inbound_resource_sid": null, |
| 43 | + "inbound_resource_status": null, |
| 44 | + "inbound_resource_type": null, |
| 45 | + "inbound_resource_url": null, |
| 46 | + "outbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 47 | + "outbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 48 | + "outbound_resource_status": "sent", |
| 49 | + "outbound_resource_type": "Message", |
| 50 | + "outbound_resource_url": null, |
| 51 | + "sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 52 | + "type": "message", |
| 53 | + "url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 54 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 55 | + "session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 56 | + } |
| 57 | + ''' |
| 58 | + )) |
| 59 | + |
| 60 | + actual = self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 61 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 62 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 63 | + .message_interactions.create() |
| 64 | + |
| 65 | + self.assertIsNotNone(actual) |
| 66 | + |
| 67 | + def test_fetch_request(self): |
| 68 | + self.holodeck.mock(Response(500, '')) |
| 69 | + |
| 70 | + with self.assertRaises(TwilioException): |
| 71 | + self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 72 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 73 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 74 | + .message_interactions(sid="KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() |
| 75 | + |
| 76 | + self.holodeck.assert_has_request(Request( |
| 77 | + 'get', |
| 78 | + 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', |
| 79 | + )) |
| 80 | + |
| 81 | + def test_fetch_response(self): |
| 82 | + self.holodeck.mock(Response( |
| 83 | + 200, |
| 84 | + ''' |
| 85 | + { |
| 86 | + "service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 87 | + "data": "data", |
| 88 | + "date_created": "2015-07-30T20:00:00Z", |
| 89 | + "date_updated": "2015-07-30T20:00:00Z", |
| 90 | + "participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 91 | + "inbound_participant_sid": null, |
| 92 | + "inbound_resource_sid": null, |
| 93 | + "inbound_resource_status": null, |
| 94 | + "inbound_resource_type": null, |
| 95 | + "inbound_resource_url": null, |
| 96 | + "outbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 97 | + "outbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 98 | + "outbound_resource_status": "sent", |
| 99 | + "outbound_resource_type": "Message", |
| 100 | + "outbound_resource_url": null, |
| 101 | + "sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 102 | + "type": "message", |
| 103 | + "url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 104 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 105 | + "session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 106 | + } |
| 107 | + ''' |
| 108 | + )) |
| 109 | + |
| 110 | + actual = self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 111 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 112 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 113 | + .message_interactions(sid="KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() |
| 114 | + |
| 115 | + self.assertIsNotNone(actual) |
| 116 | + |
| 117 | + def test_list_request(self): |
| 118 | + self.holodeck.mock(Response(500, '')) |
| 119 | + |
| 120 | + with self.assertRaises(TwilioException): |
| 121 | + self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 122 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 123 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 124 | + .message_interactions.list() |
| 125 | + |
| 126 | + self.holodeck.assert_has_request(Request( |
| 127 | + 'get', |
| 128 | + 'https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions', |
| 129 | + )) |
| 130 | + |
| 131 | + def test_read_empty_response(self): |
| 132 | + self.holodeck.mock(Response( |
| 133 | + 200, |
| 134 | + ''' |
| 135 | + { |
| 136 | + "interactions": [], |
| 137 | + "meta": { |
| 138 | + "previous_page_url": null, |
| 139 | + "next_page_url": null, |
| 140 | + "url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions?PageSize=50&Page=0", |
| 141 | + "page": 0, |
| 142 | + "first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessageInteractions?PageSize=50&Page=0", |
| 143 | + "page_size": 50, |
| 144 | + "key": "interactions" |
| 145 | + } |
| 146 | + } |
| 147 | + ''' |
| 148 | + )) |
| 149 | + |
| 150 | + actual = self.client.proxy.v1.services(sid="KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 151 | + .sessions(sid="KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 152 | + .participants(sid="KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ |
| 153 | + .message_interactions.list() |
| 154 | + |
| 155 | + self.assertIsNotNone(actual) |
0 commit comments