policies/reputation: fix tests
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
c89b8a5f7c
commit
f51ab7a878
|
@ -4,7 +4,6 @@ from django.db import models
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from rest_framework.serializers import BaseSerializer
|
from rest_framework.serializers import BaseSerializer
|
||||||
|
|
||||||
from authentik.core.models import User
|
|
||||||
from authentik.lib.utils.http import get_client_ip
|
from authentik.lib.utils.http import get_client_ip
|
||||||
from authentik.policies.models import Policy
|
from authentik.policies.models import Policy
|
||||||
from authentik.policies.types import PolicyRequest, PolicyResult
|
from authentik.policies.types import PolicyRequest, PolicyResult
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
|
|
||||||
from authentik.core.models import User
|
|
||||||
from authentik.events.monitored_tasks import MonitoredTask, TaskResult, TaskResultStatus
|
from authentik.events.monitored_tasks import MonitoredTask, TaskResult, TaskResultStatus
|
||||||
from authentik.policies.reputation.models import IPReputation, UserReputation
|
from authentik.policies.reputation.models import IPReputation, UserReputation
|
||||||
from authentik.policies.reputation.signals import (
|
from authentik.policies.reputation.signals import (
|
||||||
|
|
|
@ -44,7 +44,9 @@ class TestReputationPolicy(TestCase):
|
||||||
self.assertEqual(cache.get(CACHE_KEY_USER_PREFIX + self.test_username), -1)
|
self.assertEqual(cache.get(CACHE_KEY_USER_PREFIX + self.test_username), -1)
|
||||||
# Save cache and check db values
|
# Save cache and check db values
|
||||||
save_user_reputation.delay().get()
|
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):
|
def test_policy(self):
|
||||||
"""Test Policy"""
|
"""Test Policy"""
|
||||||
|
|
Reference in New Issue