mirror of
https://github.com/jazzband/django-defender.git
synced 2026-05-24 23:23:48 +00:00
Remove incorrect tests
This commit is contained in:
parent
c4223ffb78
commit
6efe11128a
2 changed files with 6 additions and 23 deletions
|
|
@ -45,17 +45,12 @@ 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
|
and not config.DISABLE_IP_LOCKOUT and not config.DISABLE_USERNAME_LOCKOUT
|
||||||
):
|
):
|
||||||
q = q & Q(ip_address=ip_address) & Q(username=username)
|
q = q & Q(ip_address=ip_address) & Q(username=username)
|
||||||
elif not config.LOCKOUT_BY_IP_USERNAME:
|
elif ip_address and not config.DISABLE_IP_LOCKOUT:
|
||||||
if ip_address and not config.DISABLE_IP_LOCKOUT:
|
failure_limit = config.IP_FAILURE_LIMIT
|
||||||
failure_limit = config.IP_FAILURE_LIMIT
|
q = q & Q(ip_address=ip_address)
|
||||||
q = q & Q(ip_address=ip_address)
|
elif username and not config.DISABLE_USERNAME_LOCKOUT:
|
||||||
elif username and not config.DISABLE_USERNAME_LOCKOUT:
|
failure_limit = config.USERNAME_FAILURE_LIMIT
|
||||||
failure_limit = config.USERNAME_FAILURE_LIMIT
|
q = q & Q(username=username)
|
||||||
q = q & Q(username=username)
|
|
||||||
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")
|
|
||||||
else:
|
else:
|
||||||
# If we've made it this far and didn't hit one of the other if or elif
|
# 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.
|
# conditions, we're in an inappropriate context.
|
||||||
|
|
|
||||||
|
|
@ -995,18 +995,6 @@ class AccessAttemptTest(DefenderTestCase):
|
||||||
def test_approx_account_lockout_count_default_case_invalid_args_pt2(self):
|
def test_approx_account_lockout_count_default_case_invalid_args_pt2(self):
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
get_approx_account_lockouts_from_login_attempts(username=VALID_USERNAME)
|
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):
|
class SignalTest(DefenderTestCase):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue