mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
test template render with request context
This commit is contained in:
parent
e7c6cc4357
commit
cc2be97f34
|
@ -3,6 +3,12 @@ import re
|
|||
from django.shortcuts import render
|
||||
|
||||
|
||||
def test_base_template_with_context():
|
||||
context = {'request': True, 'csrf_token': 'TOKEN'}
|
||||
result = render({}, 'rest_framework/base.html', context=context)
|
||||
assert re.search(r'\bcsrfToken: "TOKEN"', result.content.decode('utf-8'))
|
||||
|
||||
|
||||
def test_base_template_with_no_context():
|
||||
# base.html should be renderable with no context,
|
||||
# so it can be easily extended.
|
||||
|
|
Loading…
Reference in New Issue
Block a user