Ejemplo n.º 1
0
def _delete_voicemail_with_id(channel, voicemail_id):
    from xivo_dao.data_handler.voicemail import services as voicemail_services
    from xivo_dao.data_handler.user_voicemail import services as user_voicemail_services
    from xivo_dao.data_handler.exception import NotFoundError

    try:
        user_voicemail = user_voicemail_services.find_by_voicemail_id(voicemail_id)
        if user_voicemail:
            user_voicemail_services.dissociate(user_voicemail)

        voicemail = voicemail_services.get(voicemail_id)
        voicemail_services.delete(voicemail)

    except NotFoundError:
        pass
Ejemplo n.º 2
0
def _delete_voicemail_with_id(channel, voicemail_id):
    from xivo_dao.data_handler.voicemail import services as voicemail_services
    from xivo_dao.data_handler.user_voicemail import services as user_voicemail_services
    from xivo_dao.data_handler.exception import ElementNotExistsError

    try:
        user_voicemail = user_voicemail_services.find_by_voicemail_id(voicemail_id)
        if user_voicemail:
            user_voicemail_services.dissociate(user_voicemail)

        voicemail = voicemail_services.get(voicemail_id)
        voicemail_services.delete(voicemail)

    except ElementNotExistsError:
        pass
Ejemplo n.º 3
0
    def test_delete(self,
                    sysconfd_connector_delete_voicemail_storage,
                    voicemail_dao_delete,
                    voicemail_notifier_deleted,
                    validate_delete):
        voicemail_id = 12
        number = '42'
        context = 'default'

        voicemail = Mock(Voicemail)
        voicemail.id = voicemail_id
        voicemail.number = number
        voicemail.context = context

        voicemail_services.delete(voicemail)

        validate_delete.assert_called_once_with(voicemail)
        voicemail_dao_delete.assert_called_once_with(voicemail)
        sysconfd_connector_delete_voicemail_storage.assert_called_once_with(number, context)
        voicemail_notifier_deleted.assert_called_once_with(voicemail)
Ejemplo n.º 4
0
def delete(voicemailid):
    voicemail = voicemail_services.get(voicemailid)
    voicemail_services.delete(voicemail)
    return make_response('', 204)