diff options
| author | aryan <aryan@Aryans-MacBook-Pro.local> | 2020-09-28 10:09:29 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-09-30 10:29:08 +0200 |
| commit | 21b127bfbc8738705ecee97407161caae612d6b1 (patch) | |
| tree | 1616572e636b59411b71e73f6ef177d109c8da23 /tests/file_uploads/uploadhandler.py | |
| parent | 5fcfe5361e5b8c9738b1ee4c1e9a6f293a7dda40 (diff) | |
Refs #30422 -- Added test for removing temporary files in MultiPartParser when StopUpload is raised.
Diffstat (limited to 'tests/file_uploads/uploadhandler.py')
| -rw-r--r-- | tests/file_uploads/uploadhandler.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/file_uploads/uploadhandler.py b/tests/file_uploads/uploadhandler.py index 7c6199fd16..9ad335301f 100644 --- a/tests/file_uploads/uploadhandler.py +++ b/tests/file_uploads/uploadhandler.py @@ -2,7 +2,9 @@ Upload handlers to test the upload API. """ -from django.core.files.uploadhandler import FileUploadHandler, StopUpload +from django.core.files.uploadhandler import ( + FileUploadHandler, StopUpload, TemporaryFileUploadHandler, +) class QuotaUploadHandler(FileUploadHandler): @@ -27,6 +29,12 @@ class QuotaUploadHandler(FileUploadHandler): return None +class StopUploadTemporaryFileHandler(TemporaryFileUploadHandler): + """A handler that raises a StopUpload exception.""" + def receive_data_chunk(self, raw_data, start): + raise StopUpload() + + class CustomUploadError(Exception): pass |
