diff -r ed807b5fa10f tests/regressiontests/test_client_regress/models.py
a
|
b
|
|
11 | 11 | from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context |
12 | 12 | |
13 | 13 | class 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 | |
14 | 21 | def test_contains(self): |
15 | 22 | "Responses can be inspected for content, including counting repeated substrings" |
16 | 23 | response = self.client.get('/test_client_regress/no_template_view/') |
… |
… |
|
56 | 63 | self.assertContains(response, 'thrice', 3) |
57 | 64 | except AssertionError, e: |
58 | 65 | self.assertEquals(str(e), "Found 0 instances of 'thrice' in response (expected 3)") |
| 66 | |
| 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, '\xe5\xb3\xa0'.decode('utf-8')) |
59 | 72 | |
60 | 73 | class AssertTemplateUsedTests(TestCase): |
61 | 74 | fixtures = ['testdata.json'] |
diff -r ed807b5fa10f tests/regressiontests/test_client_regress/templates/unicode.html
-
|
+
|
|
| 1 | * 峠 (とうげ tōge "mountain pass") |
| 2 | * 榊 (さかき sakaki "tree, genus Cleyera") |
| 3 | * 畑 (はたけ hatake "field of crops") |
| 4 | * 辻 (つじ tsuji "crossroads, street") |
| 5 | * 働 (どう dō, はたら hatara(ku) "work") |
| 6 | * 腺 (せん sen, "gland") |
diff -r ed807b5fa10f tests/regressiontests/test_client_regress/urls.py
a
|
b
|
|
22 | 22 | (r'^set_session/$', views.set_session_view), |
23 | 23 | (r'^check_session/$', views.check_session_view), |
24 | 24 | (r'^request_methods/$', views.request_methods_view), |
| 25 | (r'^check_unicode/$', views.return_unicode), |
25 | 26 | ) |
diff -r ed807b5fa10f tests/regressiontests/test_client_regress/views.py
a
|
b
|
|
60 | 60 | def request_methods_view(request): |
61 | 61 | "A view that responds with the request method" |
62 | 62 | return HttpResponse('request method: %s' % request.method) |
| 63 | |
| 64 | def return_unicode(request): |
| 65 | return render_to_response('unicode.html') |