Input validation work and error handling
This commit is contained in:
1 parent
4e2520ee76
commit
554b7cc82c
20 files changed
+627
-96
No files matched your search
@@ -110,8 +110,8 @@ class UploadPhotoTest(unittest.TestCase):
|
||||
self.assert_no_files_or_records()
|
||||
|
||||
def test_filenames_and_names_cannot_escape_or_overwrite_storage(self):
|
||||
for _ in range(2):
|
||||
self.assertEqual(self.post_image(name='../../Display name', filename='../../photo.png').status_code, 200)
|
||||
for index in range(2):
|
||||
self.assertEqual(self.post_image(name=f'../../Display name {index}', filename='../../photo.png').status_code, 200)
|
||||
paths = list(self.storage.iterdir())
|
||||
self.assertEqual(len(paths), 2)
|
||||
self.assertTrue(all(path.name.startswith('upload-') for path in paths))
|
||||
|
||||
Reference in new issue
Block a user