Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Added test case to load EXIF data.

MadoctheHadocd0c2eb3f6589
diff --git a/wger/gallery/tests/test_gallery_image.py b/wger/gallery/tests/test_gallery_image.py
index 7d86492ef..3fbf3fdf8 100644
--- a/wger/gallery/tests/test_gallery_image.py
+++ b/wger/gallery/tests/test_gallery_image.py
@@ -38,9 +38,28 @@ class AddGalleryImageTestCase(WgerAddTestCase):
'image': open('wger/exercises/tests/protestschwein.jpg', 'rb'),
}
+class AddGalleryImageNoDateEXIFTestCase(WgerAddTestCase):
+ """
+ Tests adding an image to the gallery with no date, should read EXIF data
+ """
+
+ object_class = Image
+ url = 'gallery:images:add'
+ user_fail = False
+ data = {
+ # No date
+ 'user': 1,
+ 'description': 'EXIF Read',
+ 'image': open('wger/exercises/tests/protestschwein.jpg', 'rb'),
+ }
+
+ def post_test_hook(self):
+ image = Image.objects.filter(description='EXIF Read').first()
+ self.assertEqual(image.date, datetime.date(2026, 3, 1))
+
class AddGalleryImageNoDateTestCase(WgerAddTestCase):
"""
- Tests adding an image to the gallery
+ Tests adding an image to the gallery with no date, should default to current date
"""
object_class = Image