Пример #1
0
def dissociate_voicemail(userid):
    try:
        user_voicemail = user_voicemail_services.get_by_user_id(userid)
    except UserVoicemailNotExistsError:
        raise AssociationNotExistsError("User with id=%d does not have a voicemail" % userid)
    user_voicemail_services.dissociate(user_voicemail)
    return make_response('', 204)
Пример #2
0
    def test_dissociate(self, validate_dissociation, notifier_dissociated, dao_dissociate):
        user_voicemail = Mock(UserVoicemail)

        user_voicemail_services.dissociate(user_voicemail)

        validate_dissociation.assert_called_once_with(user_voicemail)
        dao_dissociate.assert_called_once_with(user_voicemail)
        notifier_dissociated.assert_called_once_with(user_voicemail)
Пример #3
0
    def test_dissociate(self, validate_dissociation, notifier_dissociated,
                        dao_dissociate):
        user_voicemail = Mock(UserVoicemail)

        user_voicemail_services.dissociate(user_voicemail)

        validate_dissociation.assert_called_once_with(user_voicemail)
        dao_dissociate.assert_called_once_with(user_voicemail)
        notifier_dissociated.assert_called_once_with(user_voicemail)
Пример #4
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
Пример #5
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
Пример #6
0
def dissociate_voicemail(userid):
    url.check_user_exists(userid)
    user_voicemail = user_voicemail_services.get_by_user_id(userid)
    user_voicemail_services.dissociate(user_voicemail)
    return make_response('', 204)