mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-12 01:23:11 +00:00
Using @patch instead of @override_settings
Axes configuration values are pulled from axes.settings, into axes.decorators. Using @override_settings wasn't setting AXES_ONLY_USER_FAILURES. Patching the decorator in the test set the value correctly.
This commit is contained in:
parent
153623ada3
commit
9de8b356a6
1 changed files with 1 additions and 2 deletions
|
|
@ -9,7 +9,6 @@ from mock import patch
|
|||
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import NoReverseMatch
|
||||
from django.core.urlresolvers import reverse
|
||||
|
|
@ -286,7 +285,7 @@ class AccessAttemptTest(TestCase):
|
|||
response = self._login(is_valid_username=True, is_valid_password=False)
|
||||
self.assertContains(response, self.LOCKED_MESSAGE, status_code=403)
|
||||
|
||||
@override_settings(AXES_ONLY_USER_FAILURES=True)
|
||||
@patch('axes.decorators.AXES_ONLY_USER_FAILURES', True)
|
||||
@patch('axes.decorators.cache.set', return_value=None)
|
||||
@patch('axes.decorators.cache.get', return_value=None)
|
||||
def test_lockout_by_user_only(self, cache_set_mock, cache_get_mock):
|
||||
|
|
|
|||
Loading…
Reference in a new issue