def test_edit_with_all_parameters(self): voicemail_row = self.add_voicemail( mailbox='1000', context='default', password='******', email='email@email', language='fr_FR', tz='eu-fr', attach=0, deletevoicemail=0, maxmsg=0, skipcheckpass=0 ) voicemail = voicemail_dao.get(voicemail_row.uniqueid) voicemail.name = 'newname' voicemail.number = '1001' voicemail.password = '******' voicemail.email = '*****@*****.**' voicemail.language = 'en_US' voicemail.timezone = 'en-ca' voicemail.max_messages = 10 voicemail.attach_audio = True voicemail.delete_messages = True voicemail.ask_password = False voicemail_dao.edit(voicemail) row = (self.session.query(VoicemailSchema) .filter(VoicemailSchema.uniqueid == voicemail.id) .first()) self.assertEquals(row.uniqueid, voicemail.id) self.assertEquals(row.fullname, voicemail.name) self.assertEquals(row.mailbox, voicemail.number) self.assertEquals(row.context, voicemail.context) self.assertEquals(row.password, voicemail.password) self.assertEquals(row.email, voicemail.email) self.assertEquals(row.language, voicemail.language) self.assertEquals(row.tz, voicemail.timezone) self.assertEquals(row.maxmsg, voicemail.max_messages) self.assertEquals(row.attach, voicemail.attach_audio) self.assertEquals(row.deletevoicemail, voicemail.delete_messages) self.assertEquals(row.skipcheckpass, 1)
def test_edit(self): number = '42' context = 'default' expected_name = 'totitu' voicemail = self.add_voicemail(mailbox=number, context=context) voicemail = voicemail_dao.get(voicemail.uniqueid) voicemail.name = expected_name voicemail_dao.edit(voicemail) row = (self.session.query(VoicemailSchema) .filter(VoicemailSchema.uniqueid == voicemail.id) .first()) self.assertEquals(row.uniqueid, voicemail.id) self.assertEquals(row.fullname, expected_name) self.assertEquals(row.mailbox, number) self.assertEquals(row.context, context)
def update_voicemail_fullname(user): if hasattr(user, 'voicemail_id') and user.voicemail_id is not None: voicemail = voicemail_dao.get(user.voicemail_id) voicemail.name = user.fullname voicemail_dao.edit(voicemail)
def edit(voicemail): validator.validate_edit(voicemail) voicemail_dao.edit(voicemail) notifier.edited(voicemail)