def test_edit(self): username = '******' secret = 'kiki' expected_name = 'huhu' expected_context = 'popo' line_sip = self.add_usersip(name=username, username=username, secret=secret) line = self.add_line(protocolid=line_sip.id, name=username, context=line_sip.context) expected_line = line_dao.get(line.id) expected_line.name = expected_name expected_line.username = expected_name expected_line.context = expected_context line_dao.edit(expected_line) line_row = (self.session.query(LineSchema) .filter(LineSchema.id == expected_line.id) .first()) line_sip_row = (self.session.query(UserSIPSchema) .filter(UserSIPSchema.id == expected_line.protocolid) .first()) self.assertEquals(line_row.name, expected_name) self.assertEquals(line_row.context, expected_context) self.assertEquals(line_sip_row.name, expected_name) self.assertEquals(line_sip_row.context, expected_context)
def associate_line_to_device(device, line): line.device_id = str(device.id) line_dao.edit(line) provd_converter.link_device_config(device) rebuild_device_config(device)
def update_caller_id(main_user, line, extension=None): exten = extension.exten if extension else None line.callerid = caller_id.assemble_caller_id(main_user.fullname, exten) line_dao.edit(line)