Ticket #7654: file_uploads_tests.patch
File file_uploads_tests.patch, 2.1 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/file_uploads/views.py
67 67 """ 68 68 response = file_upload_echo(request) 69 69 request.upload_handlers.insert(0, QuotaUploadHandler()) 70 return response 71 72 def file_upload_quota_broken_when_looking_at_post(request): 73 """ 74 You can't change handlers after reading POST; this view shouldn't work. 75 """ 76 post_copy = request.POST.copy() 77 request.upload_handlers.insert(0, QuotaUploadHandler()) 78 response = file_upload_echo(request) 70 79 return response 80 No newline at end of file -
tests/regressiontests/file_uploads/tests.py
154 154 self.client.post, 155 155 '/file_uploads/quota/broken/', 156 156 {'f': open(f.name)} 157 ) 157 ) 158 159 def test_broken_custom_upload_handler_when_examining_post(self): 160 f = tempfile.NamedTemporaryFile() 161 f.write('a' * (2 ** 21)) 162 163 # AttributeError: You cannot alter upload handlers after the upload has been processed. 164 self.assertRaises( 165 AttributeError, 166 self.client.post, 167 '/file_uploads/quota/broken/post/', 168 {'f': open(f.name)} 169 ) 158 170 171 No newline at end of file -
tests/regressiontests/file_uploads/urls.py
7 7 (r'^echo/$', views.file_upload_echo), 8 8 (r'^quota/$', views.file_upload_quota), 9 9 (r'^quota/broken/$', views.file_upload_quota_broken), 10 (r'^quota/broken/post/$', views.file_upload_quota_broken_when_looking_at_post), 10 11 )