From a8a90d9e9a258a1086625dab159978bd525fb633 Mon Sep 17 00:00:00 2001 From: Thorsten Franzel Date: Sat, 14 Dec 2019 01:02:14 +0100 Subject: [PATCH] fix test --- tests/schemas/test_openapi.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index d046d7c90..e11ca7767 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -1,5 +1,5 @@ import pytest -from django.conf.urls import url +from django.conf.urls import include, url from django.db import models from django.test import RequestFactory, TestCase, override_settings from django.utils.translation import gettext_lazy as _ @@ -698,21 +698,19 @@ class TestOperationIntrospection(TestCase): serializer_class = ExampleSerializer queryset = ExampleModel.objects.none() - from django.urls import path, include - router = routers.DefaultRouter() router.register(r'example', ExampleViewSet) generator = SchemaGenerator(patterns=[ - path(r'api/', include(router.urls)) + url(r'api/', include(router.urls)) ]) generator._initialise_endpoints() schema = generator.get_schema(request=None, public=True) - assert list(schema['paths']['/api/example/'].keys()) == ['get', 'post'] - assert list(schema['paths']['/api/example/{id}/'].keys()) == ['get', 'put', 'patch', 'delete'] - assert list(schema['components']['schemas'].keys()) == ['Example', 'PatchedExample'] + assert sorted(schema['paths']['/api/example/'].keys()) == ['get', 'post'] + assert sorted(schema['paths']['/api/example/{id}/'].keys()) == ['delete', 'get', 'patch', 'put'] + assert sorted(schema['components']['schemas'].keys()) == ['Example', 'PatchedExample'] # TODO do more checks