Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias Import alias ImportFrom alias alias ImportFrom alias alias alias alias ImportFrom alias alias ImportFrom alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad Str decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr TupleLoad Dict Str Str Str Str AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str AttributeLoad NameLoad attr TupleLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Dict Num NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Dict Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Index Str SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call NameLoad Str NameLoad keyword NameLoad Assign NameStore Call NameLoad Dict Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call NameLoad Str NameLoad keyword NameLoad Assign NameStore Call NameLoad Call AttributeLoad Str attr TupleLoad Str Str Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num keyword Dict Expr Call AttributeLoad NameLoad attr TupleLoad Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call NameLoad Str NameLoad keyword NameLoad Assign NameStore Call NameLoad Dict Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call NameLoad Str NameLoad keyword Str Assign NameStore Call NameLoad Call AttributeLoad Str attr TupleLoad Str Str Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num keyword Dict Expr Call AttributeLoad NameLoad attr TupleLoad Str NameLoad NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Return Str decorator_list decorator_list Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str keyword AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Unit tests for the modular template system.

These require a test db because they use Session objects.
 N/A json N/A unittest N/A os N/A flask lxml.html fragment_fromstring N/A werkzeug.wrappers framework.exceptions HTTPError http framework.routing Renderer JSONRenderer WebRenderer render_mako_string tests.base AppTestCase OsfTestCase website.routes OsfWebRenderer N/A HERE N/A N/A N/A os path dirname N/A N/A N/A os path abspath __file__ N/A TEMPLATES_PATH N/A N/A N/A os path join HERE templates RendererTestCase N/A AppTestCase N/A setUp N/A N/A self N/A N/A N/A N/A N/A N/A super RendererTestCase self setUp N/A N/A self r N/A Renderer N/A test_redirect N/A N/A self N/A N/A N/A When passed a Flask/Werkzeug Response object, it should be returned.
         N/A resp N/A N/A flask make_response N/A N/A N/A self assertIsInstance N/A N/A self r resp N/A N/A werkzeug wrappers Response N/A test_http_error_raised N/A N/A self N/A N/A N/A Subclasses of Renderer must implement ``.handle_error()``. N/A N/A N/A self assertRaises NotImplementedError N/A N/A N/A N/A self r N/A HTTPError N/A http NOT_FOUND N/A test_tuple N/A N/A self N/A N/A N/A Subclasses of Renderer must implement ``.render()``. N/A N/A N/A self assertRaises NotImplementedError N/A N/A N/A N/A self r N/A response text N/A N/A JSONRendererTestCase N/A RendererTestCase N/A setUp N/A N/A self N/A N/A N/A N/A N/A N/A super JSONRendererTestCase self setUp N/A N/A self r N/A JSONRenderer N/A test_redirect N/A N/A self N/A N/A N/A When passed a Flask/Werkzeug Response object, it should be returned.
         N/A resp N/A N/A flask make_response N/A N/A N/A self assertIsInstance N/A N/A self r resp N/A N/A werkzeug wrappers Response N/A test_http_error_raised N/A N/A self N/A N/A N/A When an HTTPError is raised in the view function, it is passed as
        input to the renderer.

        ``JSONRenderer`` should return a 2-tuple, where the first element is a
        dict representative of the error passed, and the second element is the
        associated HTTP status code. This mirrors the tuple format anticipated
        by Flask.
         N/A resp N/A N/A self r N/A HTTPError N/A http NOT_FOUND N/A msg N/A N/A HTTPError error_msgs N/A N/A http NOT_FOUND N/A N/A N/A self assertEqual N/A N/A code referrer message_short message_long N/A http NOT_FOUND None N/A msg N/A message_short N/A msg N/A message_long N/A http NOT_FOUND N/A N/A N/A json loads N/A resp N/A 0 N/A http NOT_FOUND N/A test_tuple N/A N/A self N/A N/A N/A N/A N/A WebRendererTestCase N/A OsfTestCase N/A setUp N/A N/A self N/A N/A N/A N/A N/A N/A super WebRendererTestCase self setUp N/A N/A self r N/A OsfWebRenderer N/A N/A N/A os path join TEMPLATES_PATH main.html render_mako_string N/A test_redirect N/A N/A self N/A N/A N/A When passed a Flask-style tuple where the HTTP status code indicates
        a redirection should take place, a Flask/Werkzeug response object should
        be returned, with the appropriate ``status_code`` and ``location`` set.

        Note that this behavior is inconsistent with that of raising an
        ``HTTPError`` in a view function, which serves the same purpose.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A resp N/A N/A self r N/A N/A 302 None http://google.com/ N/A N/A N/A self assertIsInstance resp N/A N/A werkzeug wrappers Response N/A N/A N/A self assertEqual 302 N/A resp status_code N/A N/A N/A self assertEqual http://google.com/ N/A resp location N/A test_input_dict N/A N/A self N/A N/A N/A When only a dict is passed it, a Flask-style tuple is returned, of
        which the 0th element must be the rendered template, including the dict
        as part of the context.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A input_dict N/A foo bar N/A resp N/A N/A self r input_dict N/A N/A N/A self assertIsInstance resp N/A N/A werkzeug wrappers Response N/A N/A N/A self assertIn foo:bar N/A resp data N/A test_http_error_raised N/A N/A self N/A N/A N/A When an HTTPError is raised in the view function, it is passed as
        input to the renderer.

        ``WebRenderer`` should return a 2-tuple, where the first element is the
        rendered error template. Each HTTPError exposes a ``to_data()`` method,
        which yields the appropriate error message text.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A err N/A HTTPError N/A http NOT_FOUND N/A resp N/A N/A self r err N/A N/A N/A self assertIn N/A N/A N/A err to_data N/A message_short N/A resp N/A 0 N/A N/A N/A self assertEqual N/A http NOT_FOUND N/A resp N/A 1 N/A test_http_error_raise_with_redirect N/A N/A self N/A N/A N/A Some status codes passed to HTTPError may contain a ``resource_uri``
        which specifies a location to which the user may be redirected. If a
        ``resource_uri`` is present, the ``WebRenderer`` should redirect the
        user to that URL.

        Note that some HTTP status codes - for example, 201 (Created) - are not
        well-supported by browser. As a result, while the 201 should be passed
        back to an API client, it is translated to a 301 when passed to
        ``WebRenderer``. This results in a website user being taken directly to
        a new object upon creation, instead of to an intermediate page.

        This functionality is technically a violation of the HTTP spec, and
        should be retired once we move to an API-centric web frontend.
         N/A resp N/A N/A self r N/A HTTPError N/A http CREATED redirect_url http://google.com/ N/A N/A N/A self assertIsInstance resp N/A N/A werkzeug wrappers Response N/A N/A N/A self assertEqual 302 N/A resp status_code N/A N/A N/A self assertEqual http://google.com/ N/A resp location N/A N/A WebRendererTemplateTestCase N/A OsfTestCase N/A test_nested_templates N/A N/A self N/A N/A N/A When a template passed to ``WebRenderer`` contains references to
        nested templates, those nested templates should be rendered recursively
        prior to return.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A r N/A WebRenderer nested_parent.html render_mako_string template_dir TEMPLATES_PATH N/A resp N/A r N/A N/A N/A N/A self assertIsInstance resp N/A N/A werkzeug wrappers Response N/A N/A N/A self assertIn child template content N/A resp data N/A test_render_included_template N/A N/A self N/A N/A N/A ``WebRenderer.render_element()`` is the internal method called when
        a template string is rendered. This test case examines the same
        functionality as ``test_nested_templates()`` (above), but does so
        without relying on the parent template being found and processed.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A r N/A WebRenderer nested_child.html render_mako_string template_dir TEMPLATES_PATH N/A html N/A fragment_fromstring N/A N/A join N/A <div mod-meta=' {"tpl":"nested_child.html","replace": true} '></div> create_parent remove-me N/A result N/A N/A r render_element N/A N/A N/A html findall .//*[@mod-meta] N/A 0 data N/A N/A N/A N/A self assertEqual N/A <p>child template content</p> True result N/A test_broken_template_uri N/A N/A self N/A N/A N/A When a template contains an embedded template that can't be found,
        a message indicating that should be included in the rendered page.

        NOTE: This functionality is currently failing. Instead of including the
        appropriate message in the output, an IOError is raised.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A r N/A WebRenderer nested_parent_broken.html render_mako_string template_dir TEMPLATES_PATH N/A resp N/A r N/A N/A N/A N/A self assertIn <div>Template not_a_valid_file.html not found.</div> N/A resp data N/A test_render_included_template_not_found N/A N/A self N/A N/A N/A ``WebRenderer.render_element()`` is the internal method called when
        a template string is rendered. This test case examines the same
        functionality as ``test_broken_template_uri()`` (above), but does so
        without relying on the parent template being found and processed.
         N/A N/A N/A N/A N/A self app app preprocess_request N/A r N/A WebRenderer nested_child.html render_mako_string template_dir tests/templates N/A html N/A fragment_fromstring N/A N/A join N/A <div mod-meta=' {"tpl":"not_a_real_file.html","replace": true} '></div> create_parent remove-me N/A result N/A N/A r render_element N/A N/A N/A html findall .//*[@mod-meta] N/A 0 data N/A N/A N/A N/A self assertEqual N/A <div>Template not_a_real_file.html not found.</div> True result N/A N/A JSONRendererEncoderTestCase N/A N/A unittest TestCase N/A test_encode_custom_class N/A N/A self N/A N/A TestClass N/A object N/A to_json N/A N/A self N/A N/A N/A <JSON representation> N/A N/A N/A test_object N/A TestClass N/A N/A N/A self assertEqual "<JSON representation>" N/A N/A json dumps test_object cls N/A JSONRenderer Encoder N/A test_string N/A N/A self N/A N/A N/A N/A N/A self assertEqual "my string" N/A N/A json dumps my string cls N/A JSONRenderer Encoder N/A N/A