diff --git a/tests/test_reverse.py b/tests/test_reverse.py index b26b448c9d..b89f5be43a 100644 --- a/tests/test_reverse.py +++ b/tests/test_reverse.py @@ -3,6 +3,7 @@ from rest_framework.reverse import reverse from rest_framework.test import APIRequestFactory +from rest_framework.versioning import BaseVersioning factory = APIRequestFactory() @@ -16,7 +17,7 @@ def null_view(request): ] -class MockVersioningScheme: +class MockVersioningScheme(BaseVersioning): def __init__(self, raise_error=False): self.raise_error = raise_error diff --git a/tests/test_versioning.py b/tests/test_versioning.py index d40d542290..93f61d2be4 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -1,6 +1,6 @@ import pytest from django.test import override_settings -from django.urls import include, path, re_path +from django.urls import ResolverMatch, include, path, re_path from rest_framework import serializers, status, versioning from rest_framework.decorators import APIView @@ -126,7 +126,7 @@ def test_url_path_versioning(self): assert response.data == {'version': None} def test_namespace_versioning(self): - class FakeResolverMatch: + class FakeResolverMatch(ResolverMatch): namespace = 'v1' scheme = versioning.NamespaceVersioning @@ -199,7 +199,7 @@ def test_reverse_url_path_versioning(self): assert response.data == {'url': 'http://testserver/another/'} def test_reverse_namespace_versioning(self): - class FakeResolverMatch: + class FakeResolverMatch(ResolverMatch): namespace = 'v1' scheme = versioning.NamespaceVersioning @@ -250,7 +250,7 @@ def test_invalid_url_path_versioning(self): assert response.status_code == status.HTTP_404_NOT_FOUND def test_invalid_namespace_versioning(self): - class FakeResolverMatch: + class FakeResolverMatch(ResolverMatch): namespace = 'v3' scheme = versioning.NamespaceVersioning