Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix tests

Roland Geiderad338d71e8ec
diff --git a/wger/core/models/profile.py b/wger/core/models/profile.py
index cdf3d8761..618b14e63 100644
--- a/wger/core/models/profile.py
+++ b/wger/core/models/profile.py
@@ -200,7 +200,7 @@ by the US Department of Agriculture. It is extremely complete, with around
if self.is_temporary:
return False
- days_since_joined = datetime.date.today() - self.user.date_joined
+ days_since_joined = datetime.date.today() - self.user.date_joined.date()
minimum_account_age = 21
return days_since_joined.days > minimum_account_age and self.email_verified
diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.py
index 33dc355d7..5bb47b7bc 100644
--- a/wger/core/tests/base_testcase.py
+++ b/wger/core/tests/base_testcase.py
@@ -89,7 +89,7 @@ def delete_testcase_add_methods(cls):
setattr(cls, f'test_authorized_{user}', test_authorized)
-class BaseTestCase(object):
+class BaseTestCase():
"""
Base test case.
diff --git a/wger/core/tests/test_user.py b/wger/core/tests/test_user.py
index 665074911..0d50b557f 100644
--- a/wger/core/tests/test_user.py
+++ b/wger/core/tests/test_user.py
@@ -265,7 +265,7 @@ class UserDetailPageTestCase2(WgerAccessTestCase):
)
-class UserTrustworthynessTestCase(TestCase):
+class UserTrustworthinessTestCase(WgerTestCase):
def test_temporary_user_no_permissions(self):
"""
@@ -288,7 +288,7 @@ class UserTrustworthynessTestCase(TestCase):
user = create_temporary_user()
user.userprofile.is_temporary = False
user.userprofile.email_verified = True
- user.date_joined = datetime.date.today()
+ user.date_joined = datetime.datetime.now()
# User does not pass trustworthiness check
self.assertFalse(user.userprofile.is_trustworthy)
@@ -302,7 +302,7 @@ class UserTrustworthynessTestCase(TestCase):
user = create_temporary_user()
user.userprofile.is_temporary = False
user.userprofile.email_verified = False
- user.date_joined = datetime.date.today() - datetime.timedelta(days=30)
+ user.date_joined = datetime.datetime.now() - datetime.timedelta(days=30)
# User does not pass trustworthiness check
self.assertFalse(user.userprofile.is_trustworthy)
@@ -316,7 +316,7 @@ class UserTrustworthynessTestCase(TestCase):
user = create_temporary_user()
user.userprofile.is_temporary = False
user.userprofile.email_verified = True
- user.date_joined = datetime.date.today() - datetime.timedelta(days=30)
+ user.date_joined = datetime.datetime.now() - datetime.timedelta(days=30)
# User does not pass trustworthiness check
self.assertTrue(user.userprofile.is_trustworthy)
@@ -331,7 +331,7 @@ class UserTrustworthynessTestCase(TestCase):
user.is_superuser = True
user.userprofile.is_temporary = False
user.userprofile.email_verified = False
- user.date_joined = datetime.date.today()
+ user.date_joined = datetime.datetime.now()
# User does not pass trustworthiness check
self.assertTrue(user.userprofile.is_trustworthy)