Fixes import path for django's reverse

This commit is contained in:
Michael K 2017-12-04 14:52:58 +01:00
parent 864aa60f92
commit 3a2a256821
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,6 @@
import json import json
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client, MULTIPART_CONTENT from django.test.client import Client, MULTIPART_CONTENT
from django.utils.encoding import force_text from django.utils.encoding import force_text
@ -15,6 +14,11 @@ class CustomPermissionClass(permissions.BasePermission):
def has_permission(self, request, view): def has_permission(self, request, view):
return False return False
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
class APIClient(Client): class APIClient(Client):

View File

@ -1,4 +1,3 @@
from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core import mail from django.core import mail
@ -14,6 +13,11 @@ from rest_auth.registration.app_settings import register_permission_classes
from .mixins import TestsMixin, CustomPermissionClass from .mixins import TestsMixin, CustomPermissionClass
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
@override_settings(ROOT_URLCONF="tests.urls") @override_settings(ROOT_URLCONF="tests.urls")
class APIBasicTests(TestsMixin, TestCase): class APIBasicTests(TestsMixin, TestCase):