mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Apply Black for py36
This commit is contained in:
parent
d0a1338eb4
commit
baf2349adb
2 changed files with 4 additions and 11 deletions
|
|
@ -46,13 +46,10 @@ class AxesMiddleware:
|
|||
AxesProxyHandler.update_request(request)
|
||||
username = get_client_username(request)
|
||||
credentials = get_credentials(username)
|
||||
failures_since_start = AxesProxyHandler.get_failures(
|
||||
request, credentials
|
||||
)
|
||||
failures_since_start = AxesProxyHandler.get_failures(request, credentials)
|
||||
if (
|
||||
settings.AXES_LOCK_OUT_AT_FAILURE
|
||||
and failures_since_start
|
||||
>= get_failure_limit(request, credentials)
|
||||
and failures_since_start >= get_failure_limit(request, credentials)
|
||||
):
|
||||
|
||||
request.axes_locked_out = True
|
||||
|
|
|
|||
|
|
@ -73,9 +73,7 @@ class MiddlewareTestCase(AxesTestCase):
|
|||
self.assertFalse(hasattr(self.request, "axes_updated"))
|
||||
|
||||
@mock.patch("axes.middleware.get_failure_limit", return_value=5)
|
||||
@mock.patch(
|
||||
"axes.middleware.AxesProxyHandler.get_failures", return_value=5
|
||||
)
|
||||
@mock.patch("axes.middleware.AxesProxyHandler.get_failures", return_value=5)
|
||||
@mock.patch("django.conf.settings.INSTALLED_APPS", ["rest_framework"])
|
||||
@override_settings(AXES_LOCK_OUT_AT_FAILURE=True)
|
||||
def test_lockout_response_with_drf_integration(
|
||||
|
|
@ -90,9 +88,7 @@ class MiddlewareTestCase(AxesTestCase):
|
|||
self.assertEqual(response.status_code, self.STATUS_LOCKOUT)
|
||||
|
||||
@mock.patch("axes.middleware.get_failure_limit", return_value=5)
|
||||
@mock.patch(
|
||||
"axes.middleware.AxesProxyHandler.get_failures", return_value=3
|
||||
)
|
||||
@mock.patch("axes.middleware.AxesProxyHandler.get_failures", return_value=3)
|
||||
@mock.patch("django.conf.settings.INSTALLED_APPS", ["rest_framework"])
|
||||
@override_settings(AXES_LOCK_OUT_AT_FAILURE=True)
|
||||
def test_success_response_with_drf_integration(
|
||||
|
|
|
|||
Loading…
Reference in a new issue