Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

adds tests for the new flag in exercise image

AlexisBirling30d55e4d7e172
diff --git a/wger/exercises/tests/test_exercise_images.py b/wger/exercises/tests/test_exercise_images.py
index fd1c13d58..9aea7a501 100644
--- a/wger/exercises/tests/test_exercise_images.py
+++ b/wger/exercises/tests/test_exercise_images.py
@@ -98,6 +98,34 @@ class MainImageTestCase(WgerTestCase):
self.assertFalse(ExerciseImage.objects.get(pk=pk4).is_main)
self.assertFalse(ExerciseImage.objects.get(pk=pk5).is_main)
+ def test_ai_generated_default_false(self):
+ """
+ Tests that a new image is not AI-generated by default
+ """
+
+ translation = Translation.objects.get(pk=2)
+ pk = self.save_image(translation.exercise, 'protestschwein.jpg')
+
+ image = ExerciseImage.objects.get(pk=pk)
+
+ self.assertFalse(image.is_ai_generated)
+
+ def test_ai_generated_can_be_true(self):
+ """
+ Tests that the AI-generated flag can be saved as True
+ """
+
+ translation = Translation.objects.get(pk=2)
+ pk = self.save_image(translation.exercise, 'protestschwein.jpg')
+
+ image = ExerciseImage.objects.get(pk=pk)
+
+ image.is_ai_generated = True
+ image.save()
+
+ image.refresh_from_db()
+
+ self.assertTrue(image.is_ai_generated)
# TODO: add POST and DELETE tests
class ExerciseImagesApiTestCase(