mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Add AxesModelBackend to test setup
This commit is contained in:
parent
d1f1f400b4
commit
146c3b2b39
2 changed files with 9 additions and 1 deletions
|
|
@ -19,6 +19,11 @@ MIDDLEWARE = (
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
)
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'axes.backends.AxesModelBackend',
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'axes.test_urls'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import random
|
|||
import string
|
||||
import time
|
||||
|
||||
from django.http import HttpRequest
|
||||
from django.test import TestCase, override_settings
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth import authenticate
|
||||
|
|
@ -386,6 +387,8 @@ class AccessAttemptTest(TestCase):
|
|||
``log_user_login_failed`` should shortcircuit if an attempt to authenticate
|
||||
with a custom authentication backend fails.
|
||||
'''
|
||||
authenticate(foo='bar')
|
||||
|
||||
request = HttpRequest()
|
||||
request.user = self.user
|
||||
authenticate(request=request, foo='bar')
|
||||
self.assertEqual(AccessLog.objects.all().count(), 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue