Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Can't test equality by filename anymore

Roland Geider714abefeb57d
diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.py
index 8d1451773..a52f8876e 100644
--- a/wger/core/tests/base_testcase.py
+++ b/wger/core/tests/base_testcase.py
@@ -207,7 +207,10 @@ class WgerTestCase(BaseTestCase, TestCase):
# Uploaded image or file, compare the filename
elif current_field_class in ('ImageFieldFile', 'FieldFile'):
- self.assertEqual(os.path.basename(field.name), os.path.basename(value.name))
+
+ # We can only compare the extensions, since the names can be changed
+ # Ideally we would check that the byte length is the same
+ self.assertEqual(pathlib.Path(field.name).suffix, pathlib.Path(value.name).suffix)
# Other objects (from foreign keys), check the ID
else: