summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index e3e796482..50aec88b3 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -52,6 +52,7 @@ from django.template.defaultfilters import slugify
from django.test import tag, TestCase as BaseTestCase
from django.test.client import Client
from django.test.runner import DiscoverRunner
+from django.utils.translation import ugettext_lazy as _
from ishtar_common import models, models_common
from ishtar_common import views
@@ -2508,7 +2509,7 @@ class ImportTest(TestCase):
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")
+ image_path = os.path.join("..", "ishtar_common", "tests", "test.png")
data = {
"name": "Import Zip Not Valid Must Fail",
@@ -2516,15 +2517,16 @@ class ImportTest(TestCase):
"encoding": "utf-8",
"csv_sep": "|",
"skip_lines": 1,
- }
- file_data = {
"imported_images": SimpleUploadedFile(
- "imported_images", test_file_image.read()
- )
+ name="test.png",
+ content=open(image_path, "rb").read(),
+ content_type="image/png",
+ ),
}
- 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"))
+ response = c.post(reverse("new_import"), data)
+ self.assertIn(str(_('"Associated images" field must be a valid zip file.')),
+ response.content.decode("utf-8"))
+ self.assertEqual(response.status_code, 200)
def test_archive_import(self):
imprt = self.create_import()