Created
May 8, 2012 15:53
-
-
Save prestontimmons/2636566 to your computer and use it in GitHub Desktop.
Overriding Django template loaders within tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test.utils import ( | |
setup_test_template_loader, | |
restore_template_loaders, | |
) | |
class MyTest(TestCase): | |
def setUp(self): | |
setup_test_template_loader({ | |
"basic.html": "Basic", | |
"headline.html": "{{ headline }}", | |
"has space.html": "Spaced", | |
"onetwo.html": "{{ first }}-{{ second }}", | |
}) | |
def tearDown(self): | |
restore_template_loaders() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment