예제 #1
0
    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())
예제 #2
0
    def view_callable_test(self, view_callable_class):
        @view_callable_class
        def view_callable():
            pass

        api_tree = {'/': view_callable}

        APIDocumentationMaker().create_documentation(api_tree)
예제 #3
0
    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 == {}
예제 #4
0
    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())
예제 #5
0
 def setUp(self):
     self.apidoc_view = APIDocumentationMaker()