MCPcopy
hub / github.com/django/django / test_upload_name_is_validated

Method test_upload_name_is_validated

tests/file_uploads/tests.py:72–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

70 cls.addClassCleanup(shutil.rmtree, MEDIA_ROOT)
71
72 def test_upload_name_is_validated(self):
73 candidates = [
74 "/tmp/",
75 "/tmp/..",
76 "/tmp/.",
77 ]
78 if sys.platform == "win32":
79 candidates.extend(
80 [
81 "c:\\tmp\\",
82 "c:\\tmp\\..",
83 "c:\\tmp\\.",
84 ]
85 )
86 for file_name in candidates:
87 with self.subTest(file_name=file_name):
88 self.assertRaises(SuspiciousFileOperation, UploadedFile, name=file_name)
89
90 def test_simple_upload(self):
91 with open(__file__, "rb") as fp:

Callers

nothing calls this directly

Calls 1

extendMethod · 0.80

Tested by

no test coverage detected