diff options
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 2360d4ca6..2e3026f6e 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1202,11 +1202,15 @@ class FindSearchTest(FindInit, TestCase, SearchText): self.assertEqual(res['recordsTotal'], 0) # add an image to the first find - image = Document.objects.create(title="Image!") - img = settings.ROOT_PATH + \ + document = Document.objects.create(title="Image!") + image_path = settings.ROOT_PATH + \ '../ishtar_common/static/media/images/ishtar-bg.jpg' - image.image.save('ishtar-bg.jpg', File(open(img))) - self.finds[0].documents.add(image) + document.image = SimpleUploadedFile( + name='ishtar-bg.jpg', content=open(image_path, 'rb').read(), + content_type='image/jpeg') + document.save() + + self.finds[0].documents.add(document) self.finds[0].save() response = c.get(reverse('get-find'), search) self.assertEqual(response.status_code, 200) |