Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Don't use the hard coded default cache in the tests

Roland Geidercfdade9f3ba9
diff --git a/wger/core/tests/api_base_test.py b/wger/core/tests/api_base_test.py
index a8808f078..f15d94514 100644
--- a/wger/core/tests/api_base_test.py
+++ b/wger/core/tests/api_base_test.py
@@ -14,7 +14,7 @@
# Django
from django.contrib.auth.models import User
-from django.core.cache.backends import locmem
+from django.core.cache import cache
# Third Party
from rest_framework import status
@@ -179,18 +179,16 @@ class ApiGetTestCase:
return
# Ensure the wger cache is empty.
- cache_length = len(locmem._caches['wger-cache'])
- self.assertEqual(cache_length, 0)
+
+ self.assertFalse(cache.keys('*'))
self.test_get_overview()
# If the overview is cached. Then ensure the cache isn't empty.
if self.overview_cached:
- cache_length = len(locmem._caches['wger-cache'])
- self.assertNotEqual(cache_length, 0)
+ self.assertTrue(cache.keys('*'))
else:
- cache_length = len(locmem._caches['wger-cache'])
- self.assertEqual(cache_length, 0)
+ self.assertFalse(cache.keys('*'))
def test_special_endpoints(self):
"""