Skip to content

Templates

These fixtures are related to Django templates system.

Functions

template_context

template_context(request_get, user_create)

Creates template context object.

To be used with template_render_tag fixture.

def test_this(template_context):
    context = template_context({'somevar': 'someval'})

template_render_tag

template_render_tag()

Renders a template tag from a given library by its name.

def test_this(template_render_tag):
    rendered = template_render_tag('library_name', 'mytag arg1 arg2')

template_strip_tags

template_strip_tags()

Allows HTML tags strip from string.

To be used with template_render_tag fixture to easy result assertions.

def test_this(template_strip_tags):
    stripped = template_strip_tags('<b>some</b>')