class FooBazView(GenericModelView): spec_declaration = ModelViewDeclaration(tag=False) schema = schemas['foo']() def put(self, id): """baz a foo""" pass
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
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
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
def test_invalid_kwargs(): with pytest.raises(TypeError) as excinfo: ModelViewDeclaration(putt=123) assert 'invalid keyword argument "putt"' == str(excinfo.value)