Ejemplo n.º 1
0
def create():
    data = document.parse(request)
    user = formatter.dict_to_model(data)
    user = user_services.create(user)
    result = formatter.to_api(user)
    location = url_for('.get', userid=user.id)
    return make_response(result, 201, {'Location': location})
Ejemplo n.º 2
0
def create():
    data = document.parse(request)
    user = formatter.dict_to_model(data)
    user = user_services.create(user)
    result = formatter.to_api(user)
    location = url_for('.get', userid=user.id)
    return make_response(result, 201, {'Location': location})
Ejemplo n.º 3
0
    def test_create(self, user_validate_create, user_dao_create,
                    user_notifier_created, create_private_template,
                    create_default_dial_actions_for_user,
                    create_user_destination):
        firstname = 'user'
        lastname = 'toto'
        user = User(firstname=firstname, lastname=lastname)

        user_dao_create.return_value = user

        result = user_services.create(user)

        user_validate_create.assert_called_once_with(user)
        user_dao_create.assert_called_once_with(user)
        user_notifier_created.assert_called_once_with(user)
        create_default_dial_actions_for_user.assert_called_once_with(user)
        create_user_destination.assert_called_once_with(user)

        self.assertEquals(type(result), User)
        self.assertEquals(result.private_template_id,
                          create_private_template.return_value)
Ejemplo n.º 4
0
    def test_create(self,
                    user_validate_create,
                    user_dao_create,
                    user_notifier_created,
                    create_private_template,
                    create_default_dial_actions_for_user,
                    create_user_destination):
        firstname = 'user'
        lastname = 'toto'
        user = User(firstname=firstname, lastname=lastname)

        user_dao_create.return_value = user

        result = user_services.create(user)

        user_validate_create.assert_called_once_with(user)
        user_dao_create.assert_called_once_with(user)
        user_notifier_created.assert_called_once_with(user)
        create_default_dial_actions_for_user.assert_called_once_with(user)
        create_user_destination.assert_called_once_with(user)

        self.assertEquals(type(result), User)
        self.assertEquals(result.private_template_id, create_private_template.return_value)
Ejemplo n.º 5
0
def _create_user(channel, userinfo):
    from xivo_dao.data_handler.user import services as user_services
    from xivo_dao.data_handler.user.model import User

    user = User(**userinfo)
    user_services.create(user)
Ejemplo n.º 6
0
def _create_user(channel, userinfo):
    from xivo_dao.data_handler.user import services as user_services
    from xivo_dao.data_handler.user.model import User

    user = User(**userinfo)
    user_services.create(user)