Commit graph

67 commits

Author SHA1 Message Date
Jack Sullivan
4711fb88ff Boosting code coverage 2017-05-13 13:24:23 -07:00
Jack Sullivan
25e5757aff Merge branch 'master' into logging-conf
Conflicts:
	axes/tests.py
2017-05-13 11:55:53 -07:00
Camilo Nova
49cbf128e5 Merge pull request #228 from HuntedCodes/block-configs
Fixes #222, and robust testing for lockout conditions
2017-05-09 09:35:22 -05:00
Jack Sullivan
95917a951e In tests, only set cooldown if testing it
The results for the cache unit tests were inconsistent, sometimes
blocking and other time allowing. The source of the non-determinism
was the COOLDOWN_TIME set to 2 seconds in the test. If a test took
slightly longer than the cooldown time, it would fail. Testing times
on Travis CI vary with each build, and would produce unreliable
results.

Now all tests have no cooldown period, except when the cooldown
itself is being tested. This ensures accurate and predicable test
results.
2017-04-26 12:49:44 -07:00
Jack Sullivan
082c6ac35d Boosting code coverage. 2017-04-25 15:21:41 -07:00
Jack Sullivan
c86ad06d9d Fixed #222, cache blocks by user only and ip+user
Cache hash keys now include usernames. The axes settings
AXES_ONLY_USER_FAILURES and LOCK_OUT_BY_COMBINATION_USER_AND_IP
are checked to decide which request attributes to include in
generated cache hash keys.
2017-04-22 19:19:48 -07:00
Jack Sullivan
1ed448d02f Test blocking configs, using the cache.
Added 12 tests that verify lockouts for default, AXES_ONLY_USER_FAILURES,
and LOCK_OUT_BY_COMBINATION_USER_AND_IP settings, under four conditions
each: same/different user, and same/different IP address. These tests
verify the cache functionality.
2017-04-22 18:59:32 -07:00
Jack Sullivan
fb205cc95c Test blocking configs, without the cache enabled.
Added 12 tests that verify lockouts for default, AXES_ONLY_USER_FAILURES,
and LOCK_OUT_BY_COMBINATION_USER_AND_IP settings, under four conditions
each: same/different user, and same/different IP address.

Truth Table:

  ¦ ¦ ¦ ¦ ¦ ¦ ¦User       IP           Action
  ¦ ¦ ¦ ¦ ¦ ¦|--------------------------------
IP Only      | Same       Same         Block
(Default)    | Same       Different    Allow
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Same         Block
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Different    Allow
  ¦ ¦ ¦ ¦ ¦ ¦|--------------------------------
User Only    | Same       Same         Block
  ¦ ¦ ¦ ¦ ¦ ¦| Same       Different    Block
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Same         Allow
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Different    Allow
  ¦ ¦ ¦ ¦ ¦ ¦|--------------------------------
User and IP  | Same       Same         Block
  ¦ ¦ ¦ ¦ ¦ ¦| Same       Different    Allow
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Same         Allow
  ¦ ¦ ¦ ¦ ¦ ¦| Different  Different    Allow
2017-04-22 18:48:31 -07:00
Jack Sullivan
9de8b356a6 Using @patch instead of @override_settings
Axes configuration values are pulled from axes.settings, into axes.decorators.
Using @override_settings wasn't setting AXES_ONLY_USER_FAILURES. Patching
the decorator in the test set the value correctly.
2017-04-22 18:15:28 -07:00
Aleksi Häkli
919df8ebf7 Add tests for proxy number parametrization 2017-04-10 11:47:44 +03:00
Jorge Galvis
de9fe09f5c Add test for get_cache_key function 2016-12-06 21:36:49 -05:00
Jorge Galvis
19affea1ba Merge branch 'master' into cache-attemps 2016-12-06 17:51:19 -05:00
Jorge Galvis
187195664b Fix tests after apply cache workflow 2016-12-06 16:46:16 -05:00
Camilo Nova
8fde5cf658 Merge pull request #207 from schinckel/only-check-on-post
Only look for lockable users on a POST.
2016-11-24 08:49:10 -05:00
Aleksi Häkli
41877cdecd Fix and add tests for IPv4 and IPv6 parsing
This patch does not fix IPv6 parsing with ports
2016-11-21 21:33:55 +02:00
Matthew Schinckel
90bf691e17 Fix failing test.
I think I'm just ensuring test coverage is not reduced now.
2016-11-17 16:57:12 +10:30
Matthew Schinckel
ddfd53d678 More tests. Still not entirely sure where I'm going with this yet. 2016-11-17 16:53:15 +10:30
Matthew Schinckel
68c7128885 Playing around with different is_user_lockable ideas. 2016-11-17 16:46:30 +10:30
Sam Kuehn
610f04120f fix python3 import 2016-11-07 09:02:13 -07:00
Sam Kuehn
c86f234a3a add test for is_ipv6 2016-11-04 14:54:03 -06:00
Yi Ming Yung
b49e685603 Added settings for disabling success accesslogs and added complete disabling of accesslogs 2016-11-04 14:09:48 +01:00
Camilo Nova
790f451092 Merge pull request #193 from slurms/master
Fix #192 -- AXES_DISABLE_ACCESS_LOG doesn't work.
2016-09-23 11:56:34 -05:00
Nick Sandford
99807d0a1b Fix #192 -- AXES_DISABLE_ACCESS_LOG doesn't work. 2016-09-23 14:58:29 +01:00
lip77us
cad837aac9 Added AXES_ONLY_USER_FAILURES to support only looking at the user ID and not the IP address. I needed to add this for offices that use the same IP. One user was locking the whole office out of my application. Tests updated as well. 2016-09-22 12:35:51 -07:00
Camilo Nova
a3a3798e53 Fixes status code 2016-08-18 11:13:30 -05:00
Camilo Nova
b9d5fae32a Fix for IIS used as reverse proxy. Closes #184 2016-08-18 10:55:27 -05:00
Sven Hertle
65ed32f866 Unsuccessful logins are logged even if access log is disabled 2016-08-11 12:45:53 +02:00
Sven Hertle
6b1c5787dc fixed tests 2016-08-10 17:18:57 +02:00
Sven Hertle
2b86159a40 Added possibility to disable access log 2016-08-10 16:35:02 +02:00
Camilo Nova
b20bad14f5 Removed unneeded test 2016-07-20 12:10:42 -05:00
Camilo Nova
5ece222de6 Remove unused method in test 2016-07-20 12:02:11 -05:00
Camilo Nova
08f40bc13b 🔥 Cleaning 2016-06-24 09:42:18 -05:00
Camilo Nova
036b47706a ☀️ Improved the way we run tests 2016-06-24 09:16:29 -05:00
Artur Mullakhmetov
dfe7d84907 Fix ISO8601 time duration format. 2016-06-20 17:40:17 +03:00
Artur Mullakhmetov
1c303ceec5 Add json response and iso8601 tests. 2016-05-30 16:08:34 +03:00
Артур Муллахметов
cef95f8bc3 Issue #155. Lockout response status code changed to 403. 2016-05-12 23:19:22 +03:00
Silas Barta
70af6ea206 Set IP public/private classifier to be compliant with RFC 1918. 2016-04-27 13:48:50 -07:00
Joey Wilhelm
b36e5513d9 Improved performance & DoS prevention on query2str 2015-10-09 16:08:27 -07:00
afioca
796bc43646 Fix #_get_user_attempts to include username when filtering AccessAttempts if AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP is True 2015-08-31 10:18:27 -04:00
Camilo Nova
2dfcf969d8 Revert "properly use username and IP when pulling attempts. add test and easier testing command." 2015-06-26 09:07:22 -05:00
Steve Byerly
4a926c7cc6 properly use username and IP when pulling attempts. add test. 2015-06-23 09:16:01 -07:00
Tobias Birmili
3a3b955225 Fixes sending the user_locked_out signal.
It also adds a test for that. Fixes #94.
2015-04-29 14:08:03 +02:00
Camilo Nova
41ad3cc806 Cleaned testing, removing global state and made some tweaks 2015-03-23 08:56:22 -05:00
Camilo Nova
22a7d7e160 Refactored tests to be more stable and faster 2014-05-10 12:09:25 -05:00
Camilo Nova
6973609cae Clean client references 2014-05-10 10:34:05 -05:00
Camilo Nova
9c468ecb4e Fixed admin login url 2014-05-10 10:31:57 -05:00
Camilo Nova
33fe4f02b3 Fixed conflict 2014-05-10 09:44:52 -05:00
Camilo Nova
bbd688b4d2 Remove hardcoded url path 2014-05-05 16:11:54 -05:00
Andrew Crosio
298ba366b8 fixing tests for django 1.7 2014-04-25 14:55:58 +04:00
Camilo Nova
4e2a9bd02d Fixes object type issue, response is not an string 2014-04-09 07:11:02 -05:00