def test_people_import_personal_contacts_csv_result(self): result = { 'failed': [{ 'line': 3, 'errors': ['missing fields'] }], 'created': [{ 'firstname': 'Toto', 'lastname': 'Bélanger' }, { 'firstname': 'Tata', 'lastanem': 'Bergeron' }] } expected = { 'class': 'people_import_personal_contacts_csv_result', 'failed': result['failed'], 'created_count': len(result['created']) } result = CTIMessageFormatter.people_import_personal_contacts_csv_result( result) assert_that(result, equal_to(expected))
def _send_import_personal_contacts_csv_result(self, user_id, result): xuserid = 'xivo/{user_id}'.format(user_id=user_id) message = CTIMessageFormatter.people_import_personal_contacts_csv_result(result) self._cti_server.send_to_cti_client(xuserid, message)