From 3a2a25682114aa6486c8f10f9069a1812c2fb63d Mon Sep 17 00:00:00 2001 From: Michael K Date: Mon, 4 Dec 2017 14:52:58 +0100 Subject: [PATCH] Fixes import path for django's reverse --- rest_auth/tests/mixins.py | 6 +++++- rest_auth/tests/test_api.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rest_auth/tests/mixins.py b/rest_auth/tests/mixins.py index 437f458..91f0001 100644 --- a/rest_auth/tests/mixins.py +++ b/rest_auth/tests/mixins.py @@ -1,7 +1,6 @@ import json from django.conf import settings -from django.core.urlresolvers import reverse from django.test.client import Client, MULTIPART_CONTENT from django.utils.encoding import force_text @@ -15,6 +14,11 @@ class CustomPermissionClass(permissions.BasePermission): def has_permission(self, request, view): return False +try: + from django.urls import reverse +except ImportError: + from django.core.urlresolvers import reverse + class APIClient(Client): diff --git a/rest_auth/tests/test_api.py b/rest_auth/tests/test_api.py index d33635c..9c5fd9e 100644 --- a/rest_auth/tests/test_api.py +++ b/rest_auth/tests/test_api.py @@ -1,4 +1,3 @@ -from django.core.urlresolvers import reverse from django.test import TestCase, override_settings from django.contrib.auth import get_user_model from django.core import mail @@ -14,6 +13,11 @@ from rest_auth.registration.app_settings import register_permission_classes 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") class APIBasicTests(TestsMixin, TestCase):