Adjust test case

This commit is contained in:
Carlton Gibson 2017-09-14 11:30:45 +02:00
parent 6f0bbe1438
commit 0e5cb69449

View File

@ -15,6 +15,7 @@ from rest_framework.schemas import (
AutoSchema, ManualSchema, SchemaGenerator, get_schema_view
)
from rest_framework.test import APIClient, APIRequestFactory
from rest_framework.utils import formatting
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
@ -579,7 +580,7 @@ class TestDescriptor(TestCase):
assert link == expected
def test_docstring_is_not_stripped_by_get_description():
class ExampleDocstringAPIView(APIView):
"""
=== title
@ -607,16 +608,8 @@ the end
def post(self, request, *args, **kwargs):
pass
class TestDocstringIsNotStrippedByGetDescription(TestCase):
def setUp(self):
self.patterns = [
url('^example/?$', ExampleDocstringAPIView.as_view()),
]
def test_docstring(self):
view = ExampleDocstringAPIView()
schema = view.schema
descr = schema.get_description('example', 'get')
# the first and last character are '\n' correctly removed by get_description
assert descr == ExampleDocstringAPIView.__doc__[1:][:-1]
assert descr == formatting.dedent(ExampleDocstringAPIView.__doc__[1:][:-1])