def view_test(self, *keys): decorator_values = { 'required': { 'x': object }, 'optional': { 'y': object }, 'unlimited': True, 'returns': object, } decorator_kwargs = {ikey: decorator_values[ikey] for ikey in keys} @api_view(**decorator_kwargs) def view_callable(**kwargs): pass api_tree = {'/': {GET: view_callable}} documentation = APIDocumentationMaker().create_documentation(api_tree) view_dict = documentation['/']['GET'] view_dict.pop('description', None) assert set(keys) == set(view_dict.keys())
def view_callable_test(self, view_callable_class): @view_callable_class def view_callable(): pass api_tree = {'/': view_callable} APIDocumentationMaker().create_documentation(api_tree)
def skip_keys_test(self, parameter_kind): api_tree = self.make_api_tree(parameter_kind) documentation = APIDocumentationMaker().create_documentation(api_tree) view_dict = documentation['/']['GET'].copy() del view_dict['description'] assert view_dict == {}
def no_mutation_test(self, parameter_kind): """ Confirm that this behavior does not mutate the iospec dictionaries of the view-callable's IOManager in-place. """ api_tree = self.make_api_tree(parameter_kind) view_callable = api_tree['/'][GET] # Confirm that '_call' works before 'create_documentation'. view_callable._call(x=object()) APIDocumentationMaker().create_documentation(api_tree) # Confirm that '_call' works after 'create_documentation'. view_callable._call(x=object())
def setUp(self): self.apidoc_view = APIDocumentationMaker()