mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-12-02 05:43:44 +03:00
Merge pull request #69 from robdox/master
Implement tox for testing against all python/django versions.
This commit is contained in:
commit
2a43288ec7
17
README.md
17
README.md
|
@ -51,6 +51,21 @@ The easiest way to run test coverage is with [`coverage`](https://pypi.org/proje
|
|||
which runs the tests against all supported Django installs. To run the test coverage
|
||||
within a virtualenv, run `coverage run ./runtests.py` from the repository directory then run `coverage report`.
|
||||
|
||||
#### Tox
|
||||
|
||||
Testing may also be done using [`tox`](https://pypi.org/project/tox/), which
|
||||
will run the tests against all supported combinations of python and django.
|
||||
|
||||
Install tox, either globally or within a virtualenv, and then simply run `tox`
|
||||
from the repository directory. As there are many combinations, you may run them
|
||||
in [`parallel`](https://tox.readthedocs.io/en/latest/config.html#cmdoption-tox-p)
|
||||
using `tox --parallel`.
|
||||
|
||||
The `tox.ini` includes an environment for testing code [`coverage`](https://pypi.org/project/coverage/)
|
||||
and you can run it and view this report with `tox -e coverage`.
|
||||
|
||||
Linting may also be performed via [`flake8`](https://pypi.org/project/flake8/)
|
||||
by running `tox -e flake8`.
|
||||
|
||||
### Documentation
|
||||
|
||||
|
@ -59,4 +74,4 @@ View the full documentation here: https://dj-rest-auth.readthedocs.io/en/latest/
|
|||
|
||||
### Acknowledgements
|
||||
|
||||
This project began as a fork of `django-rest-auth`. Big thanks to everyone who contributed to that repo!
|
||||
This project began as a fork of `django-rest-auth`. Big thanks to everyone who contributed to that repo!
|
||||
|
|
|
@ -5,4 +5,4 @@ __version__ = '1.0.5'
|
|||
__author__ = '@iMerica https://github.com/iMerica'
|
||||
__author_email__ = 'imichael@pm.me'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright 2020 @iMerica https://github.com/iMerica'
|
||||
__copyright__ = 'Copyright 2020 @iMerica https://github.com/iMerica'
|
||||
|
|
|
@ -33,6 +33,8 @@ PasswordResetConfirmSerializer = import_callable(serializers.get(
|
|||
'PASSWORD_RESET_CONFIRM_SERIALIZER', DefaultPasswordResetConfirmSerializer
|
||||
))
|
||||
|
||||
PasswordChangeSerializer = import_callable(serializers.get('PASSWORD_CHANGE_SERIALIZER', DefaultPasswordChangeSerializer))
|
||||
PasswordChangeSerializer = import_callable(
|
||||
serializers.get('PASSWORD_CHANGE_SERIALIZER', DefaultPasswordChangeSerializer)
|
||||
)
|
||||
|
||||
JWT_AUTH_COOKIE = getattr(settings, 'JWT_AUTH_COOKIE', None)
|
||||
|
|
|
@ -17,7 +17,6 @@ except ImportError:
|
|||
raise ImportError("allauth needs to be added to INSTALLED_APPS.")
|
||||
|
||||
|
||||
|
||||
class SocialAccountSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
serialize allauth SocialAccounts for use with a REST API
|
||||
|
|
|
@ -21,7 +21,6 @@ from . import django_urls
|
|||
class ExampleProtectedView(APIView):
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return Response(dict(success=True))
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ try:
|
|||
return None
|
||||
else:
|
||||
raw_token = self.get_raw_token(header)
|
||||
|
||||
|
||||
if raw_token is None:
|
||||
return None
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ class LogoutView(APIView):
|
|||
from rest_framework_simplejwt.exceptions import TokenError
|
||||
from rest_framework_simplejwt.tokens import RefreshToken
|
||||
|
||||
|
||||
cookie_name = getattr(settings, 'JWT_AUTH_COOKIE', None)
|
||||
if cookie_name:
|
||||
response.delete_cookie(cookie_name)
|
||||
|
|
37
tox.ini
Normal file
37
tox.ini
Normal file
|
@ -0,0 +1,37 @@
|
|||
# tox (https://tox.readthedocs.io/) is a tool for running tests
|
||||
# in multiple virtualenvs. This configuration file will run the
|
||||
# test suite on all supported python versions. To use it, "pip install tox"
|
||||
# and then run "tox" from this directory.
|
||||
|
||||
# Running this tox will test against all supported version
|
||||
# combinations of python and django as described at the following
|
||||
# https://docs.djangoproject.com/en/3.0/faq/install/#what-python-version-can-i-use-with-django
|
||||
# https://endoflife.date/django
|
||||
[tox]
|
||||
skipsdist = true
|
||||
envlist =
|
||||
python{3.5,3.6,3.7,3.8}-django22
|
||||
python{3.6,3.7,3.8}-django30
|
||||
|
||||
[testenv]
|
||||
commands =
|
||||
python ./runtests.py
|
||||
deps =
|
||||
-rdev-requirements.txt
|
||||
django22: Django>=2.2,<2.3
|
||||
django30: Django>=3.0,<3.1
|
||||
|
||||
# Configuration for coverage and flake8 is being set in `./setup.cfg`
|
||||
[testenv:coverage]
|
||||
commands =
|
||||
coverage run ./runtests.py
|
||||
coverage report
|
||||
deps =
|
||||
-rdev-requirements.txt
|
||||
|
||||
[testenv:flake8]
|
||||
changedir = {toxinidir}/dj_rest_auth
|
||||
commands =
|
||||
flake8 .
|
||||
deps =
|
||||
flake8==3.8.1
|
Loading…
Reference in New Issue
Block a user