Ejemplo n.º 1
0
def _delete_with_user_id(channel, user_id):
    from xivo_dao.data_handler.user import services as user_services

    user = user_services.get(user_id)

    if user:
        user_services.delete(user)
Ejemplo n.º 2
0
def _delete_with_user_id(channel, user_id):
    from xivo_dao.data_handler.user import services as user_services

    user = user_services.get(user_id)

    if user:
        user_services.delete(user)
Ejemplo n.º 3
0
    def test_get(self, user_dao_get):
        user_id = 123
        expected_result = User(id=user_id)
        user_dao_get.return_value = User(id=user_id)

        result = user_services.get(user_id)

        user_dao_get.assert_called_once_with(user_id)
        assert_that(result, equal_to(expected_result))
Ejemplo n.º 4
0
    def test_get(self, user_dao_get):
        user_id = 123
        expected_result = User(id=user_id)
        user_dao_get.return_value = User(id=user_id)

        result = user_services.get(user_id)

        user_dao_get.assert_called_once_with(user_id)
        assert_that(result, equal_to(expected_result))
Ejemplo n.º 5
0
def delete(userid):
    user = user_services.get(userid)
    user_services.delete(user)
    return make_response('', 204)
Ejemplo n.º 6
0
def edit(userid):
    data = document.parse(request)
    user = user_services.get(userid)
    formatter.update_dict_model(data, user)
    user_services.edit(user)
    return make_response('', 204)
Ejemplo n.º 7
0
def get(userid):
    user = user_services.get(userid)
    result = formatter.to_api(user)
    return make_response(result, 200)
Ejemplo n.º 8
0
def associate_voicemail(user_id, voicemail_id):
    user = user_services.get(user_id)
    voicemail = voicemail_services.get(voicemail_id)
    user.voicemail_id = voicemail.id
    user_services.edit(user)
Ejemplo n.º 9
0
def check_user_exists(user_id):
    return user_services.get(user_id)
Ejemplo n.º 10
0
def delete(userid):
    user = user_services.get(userid)
    user_services.delete(user)
    return make_response('', 204)
Ejemplo n.º 11
0
def edit(userid):
    data = document.parse(request)
    user = user_services.get(userid)
    formatter.update_dict_model(data, user)
    user_services.edit(user)
    return make_response('', 204)
Ejemplo n.º 12
0
def get(userid):
    user = user_services.get(userid)
    result = formatter.to_api(user)
    return make_response(result, 200)
Ejemplo n.º 13
0
def get_user_lines(userid):
    user = user_services.get(userid)
    user_lines = user_line_services.find_all_by_user_id(user.id)
    result = formatter.list_to_api(user_lines)
    return make_response(result, 200)
Ejemplo n.º 14
0
def get_by_user_id(user_id):
    try:
        user = user_services.get(user_id)
    except ElementNotExistsError:
        return None
    return user
Ejemplo n.º 15
0
def _delete_using_user_service(channel, user_id):
    from xivo_dao.data_handler.user import services as user_services

    user = user_services.get(user_id)
    user_services.delete(user)
Ejemplo n.º 16
0
def _delete_using_user_service(channel, user_id):
    from xivo_dao.data_handler.user import services as user_services

    user = user_services.get(user_id)
    user_services.delete(user)
Ejemplo n.º 17
0
def get_by_user_id(user_id):
    try:
        user = user_services.get(user_id)
    except ElementNotExistsError:
        return None
    return user
Ejemplo n.º 18
0
def get_by_user_id(user_id):
    try:
        user = user_services.get(user_id)
    except NotFoundError:
        return None
    return user