Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Sort the list with object IDs

Roland Geider6f53cf91999a
diff --git a/wger/exercises/tests/test_exercise_base.py b/wger/exercises/tests/test_exercise_base.py
index ee156d479..482885afa 100644
--- a/wger/exercises/tests/test_exercise_base.py
+++ b/wger/exercises/tests/test_exercise_base.py
@@ -25,7 +25,7 @@ class ExerciseBaseTestCase(WgerTestCase):
@staticmethod
def get_ids(queryset):
"""Helper to return the IDs of the objects in a queryset"""
- return [i.id for i in queryset.all()]
+ return sorted([i.id for i in queryset.all()])
def test_base(self):
"""
@@ -45,10 +45,10 @@ class ExerciseBaseTestCase(WgerTestCase):
# Even if these exercises have the same base, only the variations for
# their respective languages are returned.
exercise = Exercise.objects.get(pk=81)
- self.assertListEqual([i.id for i in exercise.variations], [3, 35, 81])
+ self.assertListEqual([i.id for i in exercise.variations], sorted([3, 35, 81]))
exercise2 = Exercise.objects.get(pk=84)
- self.assertEqual([i.id for i in exercise2.variations], [84, 91, 111, 126])
+ self.assertEqual([i.id for i in exercise2.variations], sorted([84, 91, 111, 126]))
def test_images(self):
"""Test that the correct images are returned for the exercises"""