1
0
mirror of https://github.com/django/django.git synced 2024-12-28 03:55:50 +00:00
django/tests/regressiontests/views/tests/debug.py
Jacob Kaplan-Moss cc5477df89 Fixed #7529: added a FILES section to the debug view. As a bonus, we've now got
the start of a suite of tests for the debug views. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 17:10:06 +00:00

22 lines
672 B
Python

from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
class DebugViewTests(TestCase):
def setUp(self):
settings.DEBUG = True
def tearDown(self):
settings.DEBUG = False
def test_files(self):
response = self.client.get('/views/raises/')
self.assertEquals(response.status_code, 500)
data = {
'file_data.txt': SimpleUploadedFile('file_data.txt', 'haha'),
}
response = self.client.post('/views/raises/', data)
self.failUnless('file_data.txt' in response.content)
self.failIf('haha' in response.content)