Self hosted FLOSS fitness/workout, nutrition and weight tracker
test: add unit test for UserStatisticsService.get_or_create_statistics handling deleted user
infektyd134f33966ab0
diff --git a/wger/trophies/tests/test_services.py b/wger/trophies/tests/test_services.pyindex 038ef06a5..e6679d347 100644--- a/wger/trophies/tests/test_services.py+++ b/wger/trophies/tests/test_services.py@@ -106,6 +106,14 @@ class UserStatisticsServiceTestCase(WgerTestCase):self.assertEqual(stats.total_weight_lifted, Decimal('0'))+ def test_get_or_create_statistics_deleted_user(self):+ """+ Test get_or_create raises DoesNotExist for deleted user+ """+ with patch.object(User.objects, 'filter') as mock_filter:+ mock_filter.return_value.exists.return_value = False+ with self.assertRaises(User.DoesNotExist):+ UserStatisticsService.get_or_create_statistics(self.user)class TrophyServiceTestCase(WgerTestCase):"""Test the TrophyService