def test_to_obj_dict_with_existing_line(self): expected_obj_dict = { 'userfeatures': { 'musiconhold': 'default', 'entityid': 2, 'enablehint': True, 'enablexfer': True, 'firstname': 'Jack', 'lastname': 'Johnson', 'language': 'en_US', 'enableclient': True, 'loginclient': 'jack', 'passwdclient': 'jack', 'profileclient': 'Agent', 'bsfilter': 'boss', 'agentid': 1, 'mobilephonenumber': '5555555555', }, 'linefeatures': { 'id': ['23'] }, 'dialaction': { 'noanswer': { 'actiontype': 'none', }, 'busy': { 'actiontype': 'none', }, 'congestion': { 'actiontype': 'none', }, 'chanunavail': { 'actiontype': 'none', } } } user = User(firstname='Jack', lastname='Johnson', language='en_US', enable_client=True, client_username='******', client_password='******', client_profile='Agent', bsfilter='boss', entity_id=2, agent_id=1, enable_hint=True, line=UserLine(id='23'), mobile_number='5555555555') obj_dict = user.to_obj_dict() self.assertEqual(expected_obj_dict, obj_dict)
def test_to_obj_dict(self): expected_obj_dict = { 'userfeatures': { 'musiconhold': 'default', 'entityid': 2, 'enablehint': True, 'enablexfer': True, 'firstname': 'Jack', 'lastname': 'Johnson', 'language': 'en_US', 'enableclient': True, 'loginclient': 'jack', 'passwdclient': 'jack', 'profileclient': 'Agent', 'bsfilter': 'no', 'agentid': 1, 'mobilephonenumber': '5555555555', }, 'linefeatures': { 'protocol': ['sip'], 'context': ['default'], 'number': [1000], 'device': [42], 'num': [2], 'secret': ['toto'] }, 'dialaction': { 'noanswer': { 'actiontype': 'none', }, 'busy': { 'actiontype': 'none', }, 'congestion': { 'actiontype': 'none', }, 'chanunavail': { 'actiontype': 'none', }, }, 'voicemail': { 'name': 'jack johnson', 'number': 1000, 'password': '******', 'context': 'default', } } user = User(firstname='Jack', lastname='Johnson', language='en_US', enable_client=True, client_username='******', client_password='******', client_profile='Agent', bsfilter='no', entity_id=2, agent_id=1, enable_hint=True, line=UserLine(number=1000, context='default', device_id=42, device_slot=2, secret='toto'), voicemail=UserVoicemail(number=1000, name='jack johnson', password='******', context='default'), mobile_number='5555555555') obj_dict = user.to_obj_dict() self.assertEqual(expected_obj_dict, obj_dict)