mirror of
https://github.com/jazzband/django-defender.git
synced 2026-03-16 22:10:32 +00:00
Remove incorrect tests
This commit is contained in:
parent
5139005106
commit
374971bfc5
2 changed files with 6 additions and 23 deletions
|
|
@ -45,8 +45,7 @@ def get_approx_account_lockouts_from_login_attempts(ip_address=None, username=No
|
|||
and not config.DISABLE_IP_LOCKOUT and not config.DISABLE_USERNAME_LOCKOUT
|
||||
):
|
||||
q = q & Q(ip_address=ip_address) & Q(username=username)
|
||||
elif not config.LOCKOUT_BY_IP_USERNAME:
|
||||
if ip_address and not config.DISABLE_IP_LOCKOUT:
|
||||
elif ip_address and not config.DISABLE_IP_LOCKOUT:
|
||||
failure_limit = config.IP_FAILURE_LIMIT
|
||||
q = q & Q(ip_address=ip_address)
|
||||
elif username and not config.DISABLE_USERNAME_LOCKOUT:
|
||||
|
|
@ -56,9 +55,5 @@ def get_approx_account_lockouts_from_login_attempts(ip_address=None, username=No
|
|||
# If we've made it this far and didn't hit one of the other if or elif
|
||||
# conditions, we're in an inappropriate context.
|
||||
raise Exception("Invalid state requested")
|
||||
else:
|
||||
# If we've made it this far and didn't hit one of the other if or elif
|
||||
# conditions, we're in an inappropriate context.
|
||||
raise Exception("Invalid state requested")
|
||||
|
||||
return AccessAttempt.objects.filter(q).count() // failure_limit
|
||||
|
|
@ -996,18 +996,6 @@ class AccessAttemptTest(DefenderTestCase):
|
|||
with self.assertRaises(Exception):
|
||||
get_approx_account_lockouts_from_login_attempts(username=VALID_USERNAME)
|
||||
|
||||
@patch("defender.config.DISABLE_IP_LOCKOUT", True)
|
||||
@patch("defender.config.LOCKOUT_BY_IP_USERNAME", True)
|
||||
def test_approx_account_lockout_count_default_case_invalid_args_pt3(self):
|
||||
with self.assertRaises(Exception):
|
||||
get_approx_account_lockouts_from_login_attempts(ip_address="127.0.0.1", username=VALID_USERNAME)
|
||||
|
||||
@patch("defender.config.DISABLE_USERNAME_LOCKOUT", True)
|
||||
@patch("defender.config.LOCKOUT_BY_IP_USERNAME", True)
|
||||
def test_approx_account_lockout_count_default_case_invalid_args_pt4(self):
|
||||
with self.assertRaises(Exception):
|
||||
get_approx_account_lockouts_from_login_attempts(ip_address="127.0.0.1", username=VALID_USERNAME)
|
||||
|
||||
|
||||
class SignalTest(DefenderTestCase):
|
||||
""" Test that signals are properly sent when blocking usernames and IPs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue