|
| 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 ParticipantConversationTestCase(IntegrationTestCase): |
| 16 | + |
| 17 | + def test_list_request(self): |
| 18 | + self.holodeck.mock(Response(500, '')) |
| 19 | + |
| 20 | + with self.assertRaises(TwilioException): |
| 21 | + self.client.conversations.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 22 | + .participant_conversations.list() |
| 23 | + |
| 24 | + self.holodeck.assert_has_request(Request( |
| 25 | + 'get', |
| 26 | + 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ParticipantConversations', |
| 27 | + )) |
| 28 | + |
| 29 | + def test_read_empty_response(self): |
| 30 | + self.holodeck.mock(Response( |
| 31 | + 200, |
| 32 | + ''' |
| 33 | + { |
| 34 | + "conversations": [], |
| 35 | + "meta": { |
| 36 | + "page": 0, |
| 37 | + "page_size": 50, |
| 38 | + "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Identity=identity&PageSize=50&Page=0", |
| 39 | + "previous_page_url": null, |
| 40 | + "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Identity=identity&PageSize=50&Page=0", |
| 41 | + "next_page_url": null, |
| 42 | + "key": "conversations" |
| 43 | + } |
| 44 | + } |
| 45 | + ''' |
| 46 | + )) |
| 47 | + |
| 48 | + actual = self.client.conversations.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 49 | + .participant_conversations.list() |
| 50 | + |
| 51 | + self.assertIsNotNone(actual) |
| 52 | + |
| 53 | + def test_read_full_by_identity_response(self): |
| 54 | + self.holodeck.mock(Response( |
| 55 | + 200, |
| 56 | + ''' |
| 57 | + { |
| 58 | + "conversations": [ |
| 59 | + { |
| 60 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 61 | + "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 62 | + "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 63 | + "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 64 | + "conversation_friendly_name": "friendly_name", |
| 65 | + "conversation_state": "inactive", |
| 66 | + "conversation_timers": { |
| 67 | + "date_inactive": "2015-12-16T22:19:38Z", |
| 68 | + "date_closed": "2015-12-16T22:28:38Z" |
| 69 | + }, |
| 70 | + "conversation_attributes": "{}", |
| 71 | + "conversation_date_created": "2015-07-30T20:00:00Z", |
| 72 | + "conversation_date_updated": "2015-07-30T20:00:00Z", |
| 73 | + "conversation_created_by": "created_by", |
| 74 | + "conversation_unique_name": "unique_name", |
| 75 | + "participant_user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 76 | + "participant_identity": "identity", |
| 77 | + "participant_messaging_binding": null, |
| 78 | + "links": { |
| 79 | + "participant": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 80 | + "conversation": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 81 | + } |
| 82 | + } |
| 83 | + ], |
| 84 | + "meta": { |
| 85 | + "page": 0, |
| 86 | + "page_size": 50, |
| 87 | + "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Identity=identity&PageSize=50&Page=0", |
| 88 | + "previous_page_url": null, |
| 89 | + "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Identity=identity&PageSize=50&Page=0", |
| 90 | + "next_page_url": null, |
| 91 | + "key": "conversations" |
| 92 | + } |
| 93 | + } |
| 94 | + ''' |
| 95 | + )) |
| 96 | + |
| 97 | + actual = self.client.conversations.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 98 | + .participant_conversations.list() |
| 99 | + |
| 100 | + self.assertIsNotNone(actual) |
| 101 | + |
| 102 | + def test_read_full_by_address_response(self): |
| 103 | + self.holodeck.mock(Response( |
| 104 | + 200, |
| 105 | + ''' |
| 106 | + { |
| 107 | + "conversations": [ |
| 108 | + { |
| 109 | + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 110 | + "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 111 | + "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 112 | + "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 113 | + "conversation_friendly_name": "friendly_name", |
| 114 | + "conversation_state": "inactive", |
| 115 | + "conversation_timers": { |
| 116 | + "date_inactive": "2015-12-16T22:19:38Z", |
| 117 | + "date_closed": "2015-12-16T22:28:38Z" |
| 118 | + }, |
| 119 | + "conversation_attributes": "{}", |
| 120 | + "conversation_date_created": "2015-07-30T20:00:00Z", |
| 121 | + "conversation_date_updated": "2015-07-30T20:00:00Z", |
| 122 | + "conversation_created_by": "created_by", |
| 123 | + "conversation_unique_name": "unique_name", |
| 124 | + "participant_user_sid": null, |
| 125 | + "participant_identity": null, |
| 126 | + "participant_messaging_binding": { |
| 127 | + "address": "+375255555555", |
| 128 | + "proxy_address": "+12345678910", |
| 129 | + "type": "sms", |
| 130 | + "level": null, |
| 131 | + "name": null, |
| 132 | + "projected_address": null |
| 133 | + }, |
| 134 | + "links": { |
| 135 | + "participant": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 136 | + "conversation": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 137 | + } |
| 138 | + } |
| 139 | + ], |
| 140 | + "meta": { |
| 141 | + "page": 0, |
| 142 | + "page_size": 50, |
| 143 | + "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0", |
| 144 | + "previous_page_url": null, |
| 145 | + "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0", |
| 146 | + "next_page_url": null, |
| 147 | + "key": "conversations" |
| 148 | + } |
| 149 | + } |
| 150 | + ''' |
| 151 | + )) |
| 152 | + |
| 153 | + actual = self.client.conversations.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ |
| 154 | + .participant_conversations.list() |
| 155 | + |
| 156 | + self.assertIsNotNone(actual) |
0 commit comments