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/tests.py | |
| parent | 5fcfe5361e5b8c9738b1ee4c1e9a6f293a7dda40 (diff) | |
Refs #30422 -- Added test for removing temporary files in MultiPartParser when StopUpload is raised.
Diffstat (limited to 'tests/file_uploads/tests.py')
| -rw-r--r-- | tests/file_uploads/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index df8f1b8031..d8cd8425a4 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -435,6 +435,14 @@ class FileUploadTests(TestCase): with self.assertRaisesMessage(AttributeError, msg): self.client.post('/quota/broken/', {'f': file}) + def test_stop_upload_temporary_file_handler(self): + with tempfile.NamedTemporaryFile() as temp_file: + temp_file.write(b'a') + temp_file.seek(0) + response = self.client.post('/temp_file/stop_upload/', {'file': temp_file}) + temp_path = response.json()['temp_path'] + self.assertIs(os.path.exists(temp_path), False) + def test_fileupload_getlist(self): file = tempfile.NamedTemporaryFile with file() as file1, file() as file2, file() as file2a: |
