From 8f5e9965d8bff9531810610d11b0004933bafa9c Mon Sep 17 00:00:00 2001 From: shayan taki <76600102+shayanTaki@users.noreply.github.com> Date: Thu, 25 Dec 2025 02:41:05 -0800 Subject: [PATCH] Add unit tests for security check W006 --- tests/test_checks.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_checks.py b/tests/test_checks.py index 821cf6e..1f5fdaa 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -134,3 +134,19 @@ class ConfCheckTestCase(AxesTestCase): warnings = run_checks() self.assertEqual(warnings, []) + +class LockoutParametersCheckTestCase(AxesTestCase): + @override_settings(AXES_LOCKOUT_PARAMETERS=["ip_address", "username"]) + def test_valid_configuration(self): + warnings = run_checks() + self.assertEqual(warnings, []) + + @override_settings(AXES_LOCKOUT_PARAMETERS=["username", "user_agent"]) + def test_invalid_configuration(self): + warnings = run_checks() + warning = Warning( + msg=Messages.LOCKOUT_PARAMETERS_INVALID, + hint=Hints.LOCKOUT_PARAMETERS_INVALID, + id=Codes.LOCKOUT_PARAMETERS_INVALID, + ) + self.assertEqual(warnings, [warning])