Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix the tests so they still test anonymous users

Roland Geiderdbc381ccad6d
diff --git a/wger/manager/tests/testcase.py b/wger/manager/tests/testcase.py
index c5dcb52a3..cb32b67a0 100644
--- a/wger/manager/tests/testcase.py
+++ b/wger/manager/tests/testcase.py
@@ -154,8 +154,7 @@ class WorkoutManagerDeleteTestCase(WorkoutManagerTestCase):
Tests deleting the object as an anonymous user
'''
- pass
- #self.delete_object(fail=True)
+ self.delete_object(fail=True)
def test_delete_object_authorized(self):
'''
@@ -249,8 +248,7 @@ class WorkoutManagerEditTestCase(WorkoutManagerTestCase):
'''
Tests editing the object as an anonymous user
'''
- pass
- #self.edit_object(fail=True)
+ self.edit_object(fail=True)
def test_edit_object_authorized(self):
'''
@@ -281,6 +279,7 @@ class WorkoutManagerAddTestCase(WorkoutManagerTestCase):
pk = None
user_success = 'admin'
user_fail = 'test'
+ anonymous_fail = True
data = {}
data_ignore = ()
@@ -349,8 +348,8 @@ class WorkoutManagerAddTestCase(WorkoutManagerTestCase):
Tests adding the object as an anonymous user
'''
- pass
- #self.add_object(fail=True)
+ if self.user_fail:
+ self.add_object(fail=self.anonymous_fail)
def test_add_object_authorized(self):
'''
@@ -365,6 +364,6 @@ class WorkoutManagerAddTestCase(WorkoutManagerTestCase):
Tests adding the object as an unauthorized, logged in user
'''
+ self.user_login(self.user_fail)
if self.user_fail:
- self.user_login(self.user_fail)
self.add_object(fail=True)
diff --git a/wger/nutrition/models.py b/wger/nutrition/models.py
index 57558725d..1be1c30d7 100644
--- a/wger/nutrition/models.py
+++ b/wger/nutrition/models.py
@@ -242,7 +242,7 @@ class Ingredient(models.Model):
#logger.debug("{0} > {1} > {2}".format(energy_upper, energy_calculated, energy_lower))
if not ((energy_upper > energy_calculated) and (energy_calculated > energy_lower)):
- raise ValidationError(_('Total energy is not the approximate sum of the energy '
+ raise ValidationError(_('Total energy is not the approximate sum of the energy '
'provided by protein, carbohydrates and fat.'))
def compare_with_database(self):