policies/reputation: fix tests

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-29 23:19:13 +02:00
parent c89b8a5f7c
commit f51ab7a878
3 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,6 @@ from django.db import models
from django.utils.translation import gettext as _
from rest_framework.serializers import BaseSerializer
from authentik.core.models import User
from authentik.lib.utils.http import get_client_ip
from authentik.policies.models import Policy
from authentik.policies.types import PolicyRequest, PolicyResult

View File

@ -2,7 +2,6 @@
from django.core.cache import cache
from structlog.stdlib import get_logger
from authentik.core.models import User
from authentik.events.monitored_tasks import MonitoredTask, TaskResult, TaskResultStatus
from authentik.policies.reputation.models import IPReputation, UserReputation
from authentik.policies.reputation.signals import (

View File

@ -44,7 +44,9 @@ class TestReputationPolicy(TestCase):
self.assertEqual(cache.get(CACHE_KEY_USER_PREFIX + self.test_username), -1)
# Save cache and check db values
save_user_reputation.delay().get()
self.assertEqual(UserReputation.objects.get(user=self.user).score, -1)
self.assertEqual(
UserReputation.objects.get(username=self.test_username).score, -1
)
def test_policy(self):
"""Test Policy"""