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 Geider68d0b202b877
diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.py
index 83b718636..b2ff0afe9 100644
--- a/wger/core/tests/base_testcase.py
+++ b/wger/core/tests/base_testcase.py
@@ -209,7 +209,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: