# coding=utf-8
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response


class ParticipantConversationTestCase(IntegrationTestCase):

    def test_list_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.conversations.v1.participant_conversations.list()

        self.holodeck.assert_has_request(Request(
            'get',
            'https://conversations.twilio.com/v1/ParticipantConversations',
        ))

    def test_read_empty_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

    def test_read_full_by_identity_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [
                    {
                        "account_sid": "<KEY>",
                        "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_friendly_name": "friendly_name",
                        "conversation_state": "inactive",
                        "conversation_timers": {
                            "date_inactive": "2015-12-16T22:19:38Z",
                            "date_closed": "2015-12-16T22:28:38Z"
                        },
                        "conversation_attributes": "{}",
                        "conversation_date_created": "2015-07-30T20:00:00Z",
                        "conversation_date_updated": "2015-07-30T20:00:00Z",
                        "conversation_created_by": "created_by",
                        "conversation_unique_name": "unique_name",
                        "participant_user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_identity": "identity",
                        "participant_messaging_binding": null,
                        "links": {
                            "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                            "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

    def test_read_full_by_address_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [
                    {
                        "account_sid": "<KEY>",
                        "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_friendly_name": "friendly_name",
                        "conversation_state": "inactive",
                        "conversation_timers": {
                            "date_inactive": "2015-12-16T22:19:38Z",
                            "date_closed": "2015-12-16T22:28:38Z"
                        },
                        "conversation_attributes": "{}",
                        "conversation_date_created": "2015-07-30T20:00:00Z",
                        "conversation_date_updated": "2015-07-30T20:00:00Z",
                        "conversation_created_by": "created_by",
                        "conversation_unique_name": "unique_name",
                        "participant_user_sid": null,
                        "participant_identity": null,
                        "participant_messaging_binding": {
                            "address": "+375255555555",
                            "proxy_address": "+12345678910",
                            "type": "sms",
                            "level": null,
                            "name": null,
                            "projected_address": null
                        },
                        "links": {
                            "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                            "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

# coding=utf-8
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response


class ParticipantConversationTestCase(IntegrationTestCase):

    def test_list_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.conversations.v1.participant_conversations.list()

        self.holodeck.assert_has_request(Request(
            'get',
            'https://conversations.twilio.com/v1/ParticipantConversations',
        ))

    def test_read_empty_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

    def test_read_full_by_identity_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [
                    {
                        "account_sid": "<KEY>",
                        "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_friendly_name": "friendly_name",
                        "conversation_state": "inactive",
                        "conversation_timers": {
                            "date_inactive": "2015-12-16T22:19:38Z",
                            "date_closed": "2015-12-16T22:28:38Z"
                        },
                        "conversation_attributes": "{}",
                        "conversation_date_created": "2015-07-30T20:00:00Z",
                        "conversation_date_updated": "2015-07-30T20:00:00Z",
                        "conversation_created_by": "created_by",
                        "conversation_unique_name": "unique_name",
                        "participant_user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_identity": "identity",
                        "participant_messaging_binding": null,
                        "links": {
                            "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                            "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

    def test_read_full_by_address_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "conversations": [
                    {
                        "account_sid": "<KEY>",
                        "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "conversation_friendly_name": "friendly_name",
                        "conversation_state": "inactive",
                        "conversation_timers": {
                            "date_inactive": "2015-12-16T22:19:38Z",
                            "date_closed": "2015-12-16T22:28:38Z"
                        },
                        "conversation_attributes": "{}",
                        "conversation_date_created": "2015-07-30T20:00:00Z",
                        "conversation_date_updated": "2015-07-30T20:00:00Z",
                        "conversation_created_by": "created_by",
                        "conversation_unique_name": "unique_name",
                        "participant_user_sid": null,
                        "participant_identity": null,
                        "participant_messaging_binding": {
                            "address": "+375255555555",
                            "proxy_address": "+12345678910",
                            "type": "sms",
                            "level": null,
                            "name": null,
                            "projected_address": null
                        },
                        "links": {
                            "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                            "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "conversations"
                }
            }
            '''
        ))

        actual = self.client.conversations.v1.participant_conversations.list()

        self.assertIsNotNone(actual)

# coding=utf-8 This code was generated by \ / _    _  _|   _  _  | (_)\/(_)(_|\/| |(/_  v1.0.0       /       / {                 "conversations": [],                 "meta": {                     "page": 0,                     "page_size": 50,                     "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",                     "previous_page_url": null,                     "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",                     "next_page_url": null,                     "key": "conversations"                 }             } {                 "conversations": [                     {                         "account_sid": "<KEY>",                         "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "conversation_friendly_name": "friendly_name",                         "conversation_state": "inactive",                         "conversation_timers": {                             "date_inactive": "2015-12-16T22:19:38Z",                             "date_closed": "2015-12-16T22:28:38Z"                         },                         "conversation_attributes": "{}",                         "conversation_date_created": "2015-07-30T20:00:00Z",                         "conversation_date_updated": "2015-07-30T20:00:00Z",                         "conversation_created_by": "created_by",                         "conversation_unique_name": "unique_name",                         "participant_user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "participant_identity": "identity",                         "participant_messaging_binding": null,                         "links": {                             "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                             "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"                         }                     }                 ],                 "meta": {                     "page": 0,                     "page_size": 50,                     "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",                     "previous_page_url": null,                     "url": "https://conversations.twilio.com/v1/ParticipantConversations?Identity=identity&PageSize=50&Page=0",                     "next_page_url": null,                     "key": "conversations"                 }             } {                 "conversations": [                     {                         "account_sid": "<KEY>",                         "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                         "conversation_friendly_name": "friendly_name",                         "conversation_state": "inactive",                         "conversation_timers": {                             "date_inactive": "2015-12-16T22:19:38Z",                             "date_closed": "2015-12-16T22:28:38Z"                         },                         "conversation_attributes": "{}",                         "conversation_date_created": "2015-07-30T20:00:00Z",                         "conversation_date_updated": "2015-07-30T20:00:00Z",                         "conversation_created_by": "created_by",                         "conversation_unique_name": "unique_name",                         "participant_user_sid": null,                         "participant_identity": null,                         "participant_messaging_binding": {                             "address": "+375255555555",                             "proxy_address": "+12345678910",                             "type": "sms",                             "level": null,                             "name": null,                             "projected_address": null                         },                         "links": {                             "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",                             "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"                         }                     }                 ],                 "meta": {                     "page": 0,                     "page_size": 50,                     "first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",                     "previous_page_url": null,                     "url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",                     "next_page_url": null,                     "key": "conversations"                 }             }