diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-08-28 15:10:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | 131afa027985065ecf4c97600440500884a9ef26 (patch) | |
tree | a5da688b9e449157b54374adc2a347764e19e57c /archaeological_finds | |
parent | 3b4833c22507808582722125fa92355c294882d9 (diff) | |
download | Ishtar-131afa027985065ecf4c97600440500884a9ef26.tar.bz2 Ishtar-131afa027985065ecf4c97600440500884a9ef26.zip |
Documents: do not move images on hard drive after associations
Diffstat (limited to 'archaeological_finds')
-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) |