test template render with request context

This commit is contained in:
jeffrey k eliasen 2018-10-22 20:21:35 -10:00
parent e7c6cc4357
commit cc2be97f34

View File

@ -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.