def test_people_personal_contacts_result(self): personal_contacts_result = { 'column_headers': [ 'Firstname', 'Lastname', 'Phone number', 'Mobile', 'Fax', 'Email', 'Agent', 'Favorite', 'Personal' ], 'column_types': [ None, 'name', 'number_office', 'number_mobile', 'fax', 'email', 'relation_agent', 'favorite', 'personal' ], 'results': [{ 'column_values': [ 'Bob', 'Marley', '5555555', '5556666', '5553333', '*****@*****.**', None, True, True ], 'relations': { 'agent': None, 'user': None, 'endpoint': None }, 'source': 'personal' }, { 'column_values': [ 'Charlie', 'Boblin', '5555556', '5554444', '5552222', '*****@*****.**', None, False, True ], 'relations': { 'agent': None, 'user': None, 'endpoint': None }, 'source': 'personal' }] } result = CTIMessageFormatter.people_personal_contacts_result( personal_contacts_result) expected = dict(personal_contacts_result) expected.update({'class': 'people_personal_contacts_result'}) assert_that(result, equal_to(expected))
def _send_personal_contacts_result(self, user_id, result): xuserid = 'xivo/{user_id}'.format(user_id=user_id) message = CTIMessageFormatter.people_personal_contacts_result(result) self._cti_server.send_to_cti_client(xuserid, message)