Ticket #10183: 10183-cant-reproduce.diff

File 10183-cant-reproduce.diff, 3.4 KB (added by Eric Holscher, 16 years ago)

Patch of the test case I made that couldn't reproduce the above.

  • tests/regressiontests/test_client_regress/models.py

    diff --git a/tests/regressiontests/test_client_regress/__init__.pyc b/tests/regressiontests/test_client_regress/__init__.pyc
    new file mode 100644
    index 0000000..c2f9068
    Binary files /dev/null and b/tests/regressiontests/test_client_regress/__init__.pyc differ
    diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
    index 90383db..5021c03 100644
    a b from django.core.exceptions import SuspiciousOperation  
    1111from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context
    1212
    1313class AssertContainsTests(TestCase):
     14    def setUp(self):
     15        self.old_templates = settings.TEMPLATE_DIRS
     16        settings.TEMPLATE_DIRS = ()
     17
     18    def tearDown(self):
     19        settings.TEMPLATE_DIRS = self.old_templates
     20
    1421    def test_contains(self):
    1522        "Responses can be inspected for content, including counting repeated substrings"
    1623        response = self.client.get('/test_client_regress/no_template_view/')
    class AssertContainsTests(TestCase):  
    5764        except AssertionError, e:
    5865            self.assertEquals(str(e), "Found 0 instances of 'thrice' in response (expected 3)")
    5966
     67    def test_unicode_contains(self):
     68        #Regression test for #10183
     69        settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)
     70        r = self.client.get('/test_client_regress/check_unicode/')
     71        self.assertContains(r, 'aa')
     72
    6073class AssertTemplateUsedTests(TestCase):
    6174    fixtures = ['testdata.json']
    6275
  • new file tests/regressiontests/test_client_regress/templates/unicode.html

    diff --git a/tests/regressiontests/test_client_regress/models.pyc b/tests/regressiontests/test_client_regress/models.pyc
    new file mode 100644
    index 0000000..80bdb59
    Binary files /dev/null and b/tests/regressiontests/test_client_regress/models.pyc differ
    diff --git a/tests/regressiontests/test_client_regress/templates/unicode.html b/tests/regressiontests/test_client_regress/templates/unicode.html
    new file mode 100644
    index 0000000..c5c1861
    - +  
     1aaäaa¿
     2
  • tests/regressiontests/test_client_regress/urls.py

    diff --git a/tests/regressiontests/test_client_regress/urls.py b/tests/regressiontests/test_client_regress/urls.py
    index 0f9082d..c5872bf 100644
    a b urlpatterns = patterns('',  
    2222    (r'^set_session/$', views.set_session_view),
    2323    (r'^check_session/$', views.check_session_view),
    2424    (r'^request_methods/$', views.request_methods_view),
     25    (r'^check_unicode/$', views.return_unicode),
    2526)
  • tests/regressiontests/test_client_regress/views.py

    diff --git a/tests/regressiontests/test_client_regress/urls.pyc b/tests/regressiontests/test_client_regress/urls.pyc
    new file mode 100644
    index 0000000..a2cd644
    Binary files /dev/null and b/tests/regressiontests/test_client_regress/urls.pyc differ
    diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
    index bd0b8af..75b8d88 100644
    a b def check_session_view(request):  
    6060def request_methods_view(request):
    6161    "A view that responds with the request method"
    6262    return HttpResponse('request method: %s' % request.method)
     63
     64def return_unicode(request):
     65    return render_to_response('unicode.html')
Back to Top