diff --git a/passbook/core/tests/test_tasks.py b/passbook/core/tests/test_tasks.py index 90dd1c2aa..448190a22 100644 --- a/passbook/core/tests/test_tasks.py +++ b/passbook/core/tests/test_tasks.py @@ -14,5 +14,5 @@ class TestTasks(TestCase): """Test Token cleanup task""" Token.objects.create(expires=now(), user=get_anonymous_user()) self.assertEqual(Token.objects.all().count(), 1) - clean_expired_models.delay() + clean_expired_models.delay().get() self.assertEqual(Token.objects.all().count(), 0) diff --git a/passbook/policies/reputation/tasks.py b/passbook/policies/reputation/tasks.py index 7baa8a083..8b9663ab6 100644 --- a/passbook/policies/reputation/tasks.py +++ b/passbook/policies/reputation/tasks.py @@ -18,7 +18,7 @@ LOGGER = get_logger() def save_ip_reputation(self: MonitoredTask): """Save currently cached reputation to database""" objects_to_update = [] - for key, score in cache.get_many(CACHE_KEY_IP_PREFIX + "*").items(): + for key, score in cache.get_many(cache.keys(CACHE_KEY_IP_PREFIX + "*")).items(): remote_ip = key.replace(CACHE_KEY_IP_PREFIX, "") rep, _ = IPReputation.objects.get_or_create(ip=remote_ip) rep.score = score @@ -33,7 +33,7 @@ def save_ip_reputation(self: MonitoredTask): def save_user_reputation(self: MonitoredTask): """Save currently cached reputation to database""" objects_to_update = [] - for key, score in cache.get_many(CACHE_KEY_USER_PREFIX + "*").items(): + for key, score in cache.get_many(cache.keys(CACHE_KEY_USER_PREFIX + "*")).items(): username = key.replace(CACHE_KEY_USER_PREFIX, "") users = User.objects.filter(username=username) if not users.exists(): diff --git a/passbook/policies/reputation/tests.py b/passbook/policies/reputation/tests.py index 0e2e3d59b..a5a679c89 100644 --- a/passbook/policies/reputation/tests.py +++ b/passbook/policies/reputation/tests.py @@ -33,7 +33,7 @@ class TestReputationPolicy(TestCase): # Test value in cache self.assertEqual(cache.get(CACHE_KEY_IP_PREFIX + self.test_ip), -1) # Save cache and check db values - save_ip_reputation.delay() + save_ip_reputation.delay().get() self.assertEqual(IPReputation.objects.get(ip=self.test_ip).score, -1) def test_user_reputation(self): @@ -43,7 +43,7 @@ class TestReputationPolicy(TestCase): # Test value in cache self.assertEqual(cache.get(CACHE_KEY_USER_PREFIX + self.test_username), -1) # Save cache and check db values - save_user_reputation.delay() + save_user_reputation.delay().get() self.assertEqual(UserReputation.objects.get(user=self.user).score, -1) def test_policy(self): diff --git a/passbook/sources/ldap/tests/test_sync.py b/passbook/sources/ldap/tests/test_sync.py index feeb11a79..3f919ab86 100644 --- a/passbook/sources/ldap/tests/test_sync.py +++ b/passbook/sources/ldap/tests/test_sync.py @@ -48,4 +48,4 @@ class LDAPSyncTests(TestCase): @patch("passbook.sources.ldap.models.LDAPSource.connection", LDAP_CONNECTION_PATCH) def test_tasks(self): """Test Scheduled tasks""" - ldap_sync_all.delay() + ldap_sync_all.delay().get() diff --git a/passbook/stages/consent/tests.py b/passbook/stages/consent/tests.py index 893e9a1bc..5e3842822 100644 --- a/passbook/stages/consent/tests.py +++ b/passbook/stages/consent/tests.py @@ -127,7 +127,7 @@ class TestConsentStage(TestCase): ).exists() ) sleep(1) - clean_expired_models.delay() + clean_expired_models.delay().get() self.assertFalse( UserConsent.objects.filter( user=self.user, application=self.application