diff options
-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() |