Skip to content

Commit f2741bc

Browse files
authored
Merge pull request #10 from TheLazzziest/feature/django3
Feature/django3
2 parents 1472ec3 + d6b5743 commit f2741bc

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

requirements-testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
-r requirements.txt
2-
pytest==2.9.2
2+
pytest==5.3.5

rest_framework_sso/keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# coding: utf-8
22
import os
3+
import six
34

45
from cryptography.hazmat.backends import default_backend
56
from cryptography.hazmat.primitives.serialization import load_pem_private_key, load_pem_public_key
6-
from django.utils import six
77
from jwt.exceptions import InvalidKeyError
88

99
from rest_framework_sso.settings import api_settings

rest_framework_sso/models.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
from __future__ import absolute_import, unicode_literals
33

44
import uuid
5+
import six
56

67
from django.conf import settings
78
from django.db import models
8-
from django.utils import six
9-
from django.utils.encoding import python_2_unicode_compatible
9+
10+
try:
11+
from django.utils.encoding import python_2_unicode_compatible as smart_text
12+
except ImportError:
13+
from django.utils.encoding import smart_text
14+
1015
from django.utils.translation import ugettext_lazy as _
1116

1217
# Prior to Django 1.5, the AUTH_USER_MODEL setting does not exist.
@@ -22,7 +27,7 @@
2227
AUTH_USER_MODEL = getattr(settings, "AUTH_USER_MODEL", "auth.User")
2328

2429

25-
@python_2_unicode_compatible
30+
@smart_text
2631
class SessionToken(models.Model):
2732
"""
2833
The default session token model.

rest_framework_sso/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# coding: utf-8
22
from __future__ import absolute_import, unicode_literals
33

4+
import six
5+
import jwt
6+
47
from datetime import datetime
58

6-
import jwt
79
from django.contrib.auth import get_user_model
810
from django.core.serializers.json import DjangoJSONEncoder
9-
from django.utils import six, timezone
11+
from django.utils import timezone
1012
from django.utils.translation import gettext_lazy as _
1113
from jwt.exceptions import MissingRequiredClaimError, InvalidIssuerError, InvalidTokenError
1214
from rest_framework import exceptions

runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
DJANGO_SETTINGS_MODULE='tests.settings' py.test tests
2+
DJANGO_SETTINGS_MODULE='tests.settings' pytest tests

tests/test_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# coding: utf-8
22
from __future__ import absolute_import, unicode_literals
3+
import six
34

45
from cryptography.hazmat.backends.openssl.rsa import _RSAPrivateKey, _RSAPublicKey
56
from django.test import TestCase
6-
from django.utils import six
77
from jwt.exceptions import InvalidKeyError
88

99
from rest_framework_sso import keys

0 commit comments

Comments
 (0)