2020-01-01 20:17:55 +00:00
|
|
|
from axes.handlers.base import AxesHandler
|
2022-04-11 12:05:09 +00:00
|
|
|
from typing import Optional
|
2020-01-01 20:17:55 +00:00
|
|
|
|
|
|
|
|
|
2022-12-02 12:26:35 +00:00
|
|
|
class AxesTestHandler(AxesHandler):
|
2020-01-01 20:17:55 +00:00
|
|
|
"""
|
|
|
|
|
Signal handler implementation that does nothing, ideal for a test suite.
|
|
|
|
|
"""
|
|
|
|
|
|
2020-07-07 08:46:22 +00:00
|
|
|
def reset_attempts(
|
|
|
|
|
self,
|
|
|
|
|
*,
|
2022-04-11 12:05:09 +00:00
|
|
|
ip_address: Optional[str] = None,
|
|
|
|
|
username: Optional[str] = None,
|
2020-07-07 08:46:22 +00:00
|
|
|
ip_or_username: bool = False,
|
|
|
|
|
) -> int:
|
2020-01-01 20:50:28 +00:00
|
|
|
return 0
|
2020-01-01 20:17:55 +00:00
|
|
|
|
2022-04-11 12:05:09 +00:00
|
|
|
def reset_logs(self, *, age_days: Optional[int] = None) -> int:
|
2020-01-01 20:50:28 +00:00
|
|
|
return 0
|
|
|
|
|
|
2022-04-11 12:05:09 +00:00
|
|
|
def is_allowed(self, request, credentials: Optional[dict] = None) -> bool:
|
2020-01-01 20:50:28 +00:00
|
|
|
return True
|
|
|
|
|
|
2022-04-11 12:05:09 +00:00
|
|
|
def get_failures(self, request, credentials: Optional[dict] = None) -> int:
|
2020-01-01 20:50:28 +00:00
|
|
|
return 0
|