Ticket #6644: formtools.diff

File formtools.diff, 1.5 KB (added by simeon, 16 years ago)

Add tests/base.html to templates dir and hacks TEMPLATE_DIRS in testrunner to load

  • django/contrib/formtools/tests.py

     
     1import os
    12from django import newforms as forms
    23from django.contrib.formtools import preview
    34from django import http
     
    2526
    2627    def setUp(self):
    2728        # Create a FormPreview instance to share between tests
     29        # in the test runner use templates/tests/ to provide base.html
     30        test_dir = os.path.join(os.path.dirname(__file__), 'templates', 'tests')
     31        self.OLD_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
     32        if test_dir not in settings.TEMPLATE_DIRS:
     33            settings.TEMPLATE_DIRS = settings.TEMPLATE_DIRS + (test_dir,)
    2834        self.preview = preview.FormPreview(TestForm)
    2935        input_template = '<input type="hidden" name="%s" value="%s" />'
    3036        self.input = input_template % (self.preview.unused_name('stage'), "%d")
    31 
     37       
     38    def tearDown(self):
     39        settings.TEMPLATE_DIRS = self.OLD_TEMPLATE_DIRS
     40       
    3241    def test_unused_name(self):
    3342        """
    3443        Verifies name mangling to get uniue field name.
  • django/contrib/formtools/templates/tests/base.html

     
     1{% block content %}
     2{% endblock %}
Back to Top