diff options
author | Cefin <kevon@tuta.io> | 2022-07-11 09:34:33 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:17:32 +0100 |
commit | ee5e127669df7645577a66f96d1923ff2595d98a (patch) | |
tree | c27e1b4e696a2326434711b3b8b760edbf6b2d63 | |
parent | 67a504e8f8db29c323c0d81e8323b2c9e4ade49a (diff) | |
download | Ishtar-ee5e127669df7645577a66f96d1923ff2595d98a.tar.bz2 Ishtar-ee5e127669df7645577a66f96d1923ff2595d98a.zip |
Zip - Test validation : writing tests #5330
Signed-off-by: Étienne Loks <etienne.loks@iggdrasil.net>
-rw-r--r-- | ishtar_common/tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index b80c91c26..e3e796482 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -2501,6 +2501,30 @@ class ImportTest(TestCase): self.assertEqual(imprt.encoding, "utf-8") self.assertEqual(imprt.csv_sep, '|') + def test_validation_zip_import_image(self): + username, password, user = create_superuser() + c = Client() + c.login(username=username, password=password) + + imp_model = self.create_importer_model() + importer_type = self.create_importer_type(imp_model) + test_file_image = os.path.join(settings.MEDIA_ROOT, "images_not_zip.png") + + data = { + "name": "Import Zip Not Valid Must Fail", + "importer_type": importer_type.pk, + "encoding": "utf-8", + "csv_sep": "|", + "skip_lines": 1, + } + file_data = { + "imported_images": SimpleUploadedFile( + "imported_images", test_file_image.read() + ) + } + response = c.post(reverse("new_import"), data, file_data) + self.assertContains(response.content, "Associated images must be zip file.") + self.assertRedirects(response, reverse("new_import")) def test_archive_import(self): imprt = self.create_import() |