예제 #1
0
    class FooBazView(GenericModelView):
        spec_declaration = ModelViewDeclaration(tag=False)

        schema = schemas['foo']()

        def put(self, id):
            """baz a foo"""
            pass
예제 #2
0
    class FooListView(FooViewBase):
        spec_declaration = ModelViewDeclaration(many=True)

        filtering = Filtering(color=operator.eq, )
        sorting = Sorting('name', 'color')
        pagination = PagePagination(2)

        def get(self):
            pass

        def post(self):
            """test the docstring"""
            pass
예제 #3
0
    class FooListView(GenericModelView):
        schema = schemas['foo']()

        spec_declaration = ModelViewDeclaration(many=True)

        filtering = Filtering(color=operator.eq, )
        sorting = Sorting('name', 'color')
        pagination = PagePagination(2)

        def get(self):
            pass

        def post(self):
            """test the docstring"""
            pass
예제 #4
0
    class BarView(GenericModelView):
        spec_declaration = ModelViewDeclaration(
            post={'204': {
                'description': 'request the creation of a new bar'
            }},
            get={'200': {}},
        )

        pagination = RelayCursorPagination(2)

        def post(self):
            pass

        def get(self):
            pass

        def put(self):
            """put a bar"""
            pass
예제 #5
0
def test_invalid_kwargs():
    with pytest.raises(TypeError) as excinfo:
        ModelViewDeclaration(putt=123)
    assert 'invalid keyword argument "putt"' == str(excinfo.value)