Skip to content

Commit

Permalink
Merge 4097093 into 840cf58
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinkaszynski committed Oct 25, 2018
2 parents 840cf58 + 4097093 commit cdfe438
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [1.2.1] - 2018-10-25
### Added
- a test to enforce completeness of migrations
- missing migration

## [1.2.0] - 2018-07-12
### Added
- few minor utilities to make the project be easier to extend
Expand Down
2 changes: 1 addition & 1 deletion jwt_devices/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
__title__ = "Django Rest Framework JWT Devices"
__version__ = "1.2.0"
__version__ = "1.2.1"
__author__ = "Michal Proszek"
__license__ = "MIT"
__copyright__ = "Copyright 2017-2018 Arabella"
Expand Down
3 changes: 1 addition & 2 deletions jwt_devices/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ def __call__(self, request):

def process_view(self, request, view_func, view_args, view_kwargs):
view_cls = getattr(view_func, "cls", None)
if (view_cls and api_settings.JWT_PERMANENT_TOKEN_AUTH and request.META.get("HTTP_PERMANENT_TOKEN") and
view_cls != views.DeviceRefreshJSONWebToken):
if (view_cls and api_settings.JWT_PERMANENT_TOKEN_AUTH and request.META.get("HTTP_PERMANENT_TOKEN") and view_cls != views.DeviceRefreshJSONWebToken):
return JsonResponse({
"HTTP_PERMANENT_TOKEN": {
"details": _("Using the Permanent-Token header is disallowed for {}").format(type(view_cls))
Expand Down
20 changes: 20 additions & 0 deletions jwt_devices/migrations/0002_auto_20181010_2152.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-10 21:52
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('jwt_devices', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='device',
name='permanent_token',
field=models.CharField(max_length=255, unique=True),
),
]
3 changes: 1 addition & 2 deletions jwt_devices/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def post(self, request, *args, **kwargs):

response = Response(response_data)
if rfj_settings.JWT_AUTH_COOKIE:
expiration = (datetime.utcnow() +
rfj_settings.JWT_EXPIRATION_DELTA)
expiration = (datetime.utcnow() + rfj_settings.JWT_EXPIRATION_DELTA)
response.set_cookie(rfj_settings.JWT_AUTH_COOKIE,
token,
expires=expiration,
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements-codestyle.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flake8>=3.2.1
pycodestyle>=2.2.0,<2.4
flake8>=3.6.0
pycodestyle>=2.4.0
isort>=4.2.5
26 changes: 10 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
def pytest_configure():
import django
from django.conf import settings
from django.core.management import call_command

settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:"
}
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}
},
SITE_ID=1,
SECRET_KEY="not very secret in tests",
Expand All @@ -35,20 +33,17 @@ def pytest_configure():
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",

"rest_framework",
"rest_framework_jwt",
"jwt_devices",
"tests",
),
PASSWORD_HASHERS=(
"django.contrib.auth.hashers.MD5PasswordHasher",
),
PASSWORD_HASHERS=("django.contrib.auth.hashers.MD5PasswordHasher",),
REST_FRAMEWORK={
"DEFAULT_AUTHENTICATION_CLASSES": [
"jwt_devices.authentication.PermanentTokenAuthentication"
]
}
},
)

try:
Expand All @@ -57,9 +52,7 @@ def pytest_configure():
except ImportError:
pass
else:
settings.INSTALLED_APPS += (
"oauth_provider",
)
settings.INSTALLED_APPS += ("oauth_provider",)

try:
if django.VERSION >= (1, 8):
Expand All @@ -69,13 +62,14 @@ def pytest_configure():
except ImportError:
pass
else:
settings.INSTALLED_APPS += (
"provider",
"provider.oauth2",
)
settings.INSTALLED_APPS += ("provider", "provider.oauth2")

try:
import django

django.setup()
except AttributeError:
pass

call_command("migrate")
call_command("makemigrations", "--dry-run", "--check")

0 comments on commit cdfe438

Please sign in to comment.