| 1 |
from axes.handlers.base import AxesHandler |
| 2 |
from typing import Optional |
| 3 |
|
| 4 |
|
| 5 |
class AxesTestHandler(AxesHandler): # pylint: disable=unused-argument |
| 6 |
""" |
| 7 |
Signal handler implementation that does nothing, ideal for a test suite. |
| 8 |
""" |
| 9 |
|
| 10 |
def reset_attempts( |
| 11 |
self, |
| 12 |
*, |
| 13 |
ip_address: Optional[str] = None, |
| 14 |
username: Optional[str] = None, |
| 15 |
ip_or_username: bool = False, |
| 16 |
) -> int: |
| 17 |
return 0 |
| 18 |
|
| 19 |
def reset_logs(self, *, age_days: Optional[int] = None) -> int: |
| 20 |
return 0 |
| 21 |
|
| 22 |
def is_allowed(self, request, credentials: Optional[dict] = None) -> bool: |
| 23 |
return True |
| 24 |
|
| 25 |
def get_failures(self, request, credentials: Optional[dict] = None) -> int: |
| 26 |
return 0 |