Skip to content

Commit

Permalink
Remove leftover bmi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandgeider committed Nov 14, 2024
1 parent d2d4780 commit 4a099e2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 223 deletions.
4 changes: 2 additions & 2 deletions wger/core/tests/test_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from wger.utils.constants import TWOPLACES
from wger.weight.models import WeightEntry


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -63,6 +62,7 @@ def test_preferences(self):
'num_days_weight_reminder': 10,
'weight_unit': 'kg',
'birthdate': '02/25/1987',
'height': 180,
},
)

Expand All @@ -89,6 +89,7 @@ def test_preferences(self):
'num_days_weight_reminder': 10,
'weight_unit': 'lb',
'birthdate': '02/25/1987',
'height': 170,
},
)

Expand Down Expand Up @@ -306,7 +307,6 @@ def test_calculate_activities(self):
user.userprofile.calculate_activities(), decimal.Decimal(1.52).quantize(TWOPLACES)
)


# TODO: the user can't delete or create new profiles
# class UserProfileApiTestCase(api_base_test.ApiBaseResourceTestCase):
# """
Expand Down
181 changes: 0 additions & 181 deletions wger/nutrition/tests/test_bmi.py

This file was deleted.

40 changes: 0 additions & 40 deletions wger/nutrition/tests/test_calories_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,46 +69,6 @@ def test_calculator(self):
)
self.assertEqual(decimal.Decimal(result['activities']), decimal.Decimal(2920))

def test_automatic_weight_entry_bmi(self):
"""
Tests that weight entries are automatically created or updated
"""

self.user_login('test')
user = User.objects.get(username=self.current_user)

# Existing weight entry is old, a new one is created
entry1 = WeightEntry.objects.filter(user=user).latest()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {'height': 180, 'weight': 80}
)
self.assertEqual(response.status_code, 200)
entry2 = WeightEntry.objects.filter(user=user).latest()
self.assertEqual(entry1.weight, 83)
self.assertEqual(entry2.weight, 80)

# Existing weight entry is from today, is updated
entry2.delete()
entry1.date = datetime.date.today()
entry1.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {'height': 180, 'weight': 80}
)
self.assertEqual(response.status_code, 200)
entry2 = WeightEntry.objects.filter(user=user).latest()
self.assertEqual(entry1.pk, entry2.pk)
self.assertEqual(entry2.weight, 80)

# No existing entries
WeightEntry.objects.filter(user=user).delete()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {'height': 180, 'weight': 80}
)
self.assertEqual(response.status_code, 200)
entry = WeightEntry.objects.filter(user=user).latest()
self.assertEqual(entry.weight, 80)
self.assertEqual(entry.date, datetime.date.today())

def test_bmr(self):
"""
Tests the BMR view
Expand Down

0 comments on commit 4a099e2

Please sign in to comment.