def _insert_voicemail(self, mailbox, context='default'): voicemail = Voicemail() voicemail.mailbox = mailbox voicemail.context = context self.add_me(voicemail) return voicemail.uniqueid
def _insert_voicemail(self, mailbox, context='default'): voicemail = Voicemail() voicemail.mailbox = mailbox voicemail.context = context self.session.begin() self.session.add(voicemail) self.session.commit() return voicemail.uniqueid
def test_add(self): voicemail = Voicemail() voicemail.mailbox = "123" voicemail.context = "default" voicemail_dao.add(voicemail) self.assertTrue(voicemail.uniqueid > 0) returned_voicemail = (self.session.query(Voicemail).filter(Voicemail.uniqueid == voicemail.uniqueid) .first()) self.assertEquals(returned_voicemail, voicemail) contextmember = (self.session.query(ContextMember).filter(ContextMember.type == 'voicemail') .filter(ContextMember.typeval == str(voicemail.uniqueid)) .first()) self.assertEquals(contextmember.context, voicemail.context)
def _create_voicemail(channel, parameters): from xivo_dao.alchemy.voicemail import Voicemail as VoicemailSchema from xivo_dao.helpers.db_manager import DaoSession voicemail = VoicemailSchema() voicemail.fullname = parameters['name'] voicemail.mailbox = parameters['number'] voicemail.context = parameters['context'] if 'password' in parameters: voicemail.password = parameters['password'] if 'email' in parameters: voicemail.email = parameters['email'] if 'language' in parameters: voicemail.language = parameters['language'] if 'timezone' in parameters: voicemail.tz = parameters['timezone'] if 'max_messages' in parameters: voicemail.maxmsg = int(parameters['max_messages']) if 'attach_audio' in parameters: voicemail.attach = int(parameters['attach_audio']) if 'delete_messages' in parameters: voicemail.deletevoicemail = int(parameters['delete_messages']) if 'ask_password' in parameters: voicemail.skipcheckpass = int(not parameters['ask_password']) DaoSession.begin() DaoSession.add(voicemail) DaoSession.commit()