mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
☀️ Improved the way we run tests
This commit is contained in:
parent
19f4e709e8
commit
036b47706a
6 changed files with 30 additions and 15 deletions
|
|
@ -12,4 +12,4 @@ install:
|
|||
- pip install -q $DJANGO
|
||||
|
||||
script:
|
||||
- PYTHONPATH=$PYTHONPATH:$PWD django-admin.py test axes --settings=axes.test_settings
|
||||
- ./runtests.py
|
||||
|
|
|
|||
11
README.rst
11
README.rst
|
|
@ -45,9 +45,9 @@ You can contribute to this project forking it from github and sending pull reque
|
|||
Running tests
|
||||
-------------
|
||||
|
||||
Tests can be run, after you clone the repository and having django installed, like::
|
||||
Clone the repository and install the django version you want. Then run::
|
||||
|
||||
$ PYTHONPATH=$PYTHONPATH:$PWD django-admin.py test axes --settings=axes.test_settings
|
||||
$ ./runtests.py
|
||||
|
||||
|
||||
Configuration
|
||||
|
|
@ -141,6 +141,7 @@ In your code, you can use ``from axes.utils import reset``.
|
|||
* ``reset(ip=ip)`` will clear lockout/records for ip
|
||||
* ``reset(username=username)`` will clear lockout/records for username
|
||||
|
||||
|
||||
Issues
|
||||
======
|
||||
|
||||
|
|
@ -202,17 +203,17 @@ Using https://github.com/mbi/django-simple-captcha you do the following:
|
|||
return HttpResponseRedirect(reverse_lazy('signin'))
|
||||
else:
|
||||
form = AxesCaptchaForm()
|
||||
|
||||
|
||||
return render_to_response('locked_out.html', dict(form=form), context_instance=RequestContext(request))
|
||||
|
||||
5. Add a captcha template::
|
||||
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
|
||||
{{ form.captcha.errors }}
|
||||
{{ form.captcha }}
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="Submit" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from setup import VERSION
|
||||
__version__ = '1.7.0'
|
||||
|
||||
|
||||
def get_version():
|
||||
return VERSION
|
||||
return __version__
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from django.utils import six
|
|||
|
||||
from axes.decorators import COOLOFF_TIME
|
||||
from axes.decorators import FAILURE_LIMIT
|
||||
from axes.decorators import is_valid_public_ip
|
||||
from axes.decorators import is_valid_ip
|
||||
from axes.models import AccessAttempt, AccessLog
|
||||
from axes.signals import user_locked_out
|
||||
from axes.utils import reset, iso8601
|
||||
|
|
@ -240,7 +240,6 @@ class AccessAttemptTest(TestCase):
|
|||
|
||||
|
||||
class IPClassifierTest(TestCase):
|
||||
|
||||
def test_classify_private_ips(self):
|
||||
"""Tests whether is_valid_public_ip correctly classifies IPs as being
|
||||
bot public and valid
|
||||
|
|
@ -259,10 +258,10 @@ class IPClassifierTest(TestCase):
|
|||
'200.150.23.5': True, # normal public
|
||||
}
|
||||
for ip_address, is_valid_public in six.iteritems(EXPECTED):
|
||||
self.assertEqual(is_valid_public_ip(ip_address), is_valid_public)
|
||||
self.assertEqual(is_valid_ip(ip_address), is_valid_public)
|
||||
|
||||
|
||||
class UtilsTest(TestCase):
|
||||
|
||||
def test_iso8601(self):
|
||||
"""Tests iso8601 correctly translates datetime.timdelta to ISO 8601
|
||||
formatted duration."""
|
||||
|
|
|
|||
15
runtests.py
Executable file
15
runtests.py
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.test.utils import get_runner
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'axes.test_settings'
|
||||
django.setup()
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner()
|
||||
failures = test_runner.run_tests(["axes"])
|
||||
sys.exit(bool(failures))
|
||||
6
setup.py
6
setup.py
|
|
@ -3,16 +3,16 @@
|
|||
import codecs
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = '1.7.0'
|
||||
from axes import get_version
|
||||
|
||||
setup(
|
||||
name='django-axes',
|
||||
version=VERSION,
|
||||
version=get_version(),
|
||||
description="Keep track of failed login attempts in Django-powered sites.",
|
||||
long_description=(
|
||||
codecs.open("README.rst", encoding='utf-8').read() + '\n' +
|
||||
codecs.open("CHANGES.txt", encoding='utf-8').read()),
|
||||
keywords='authentication, django, pci, security',
|
||||
keywords='authentication django pci security'.split(),
|
||||
author='Josh VanderLinden, Philip Neustrom, Michael Blume, Camilo Nova',
|
||||
author_email='codekoala@gmail.com',
|
||||
maintainer='Alex Clark',
|
||||
|
|
|
|||
Loading…
Reference in a new issue