mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
add test case for get_schema_view function
This commit is contained in:
parent
91df8d29ab
commit
2978f14864
|
@ -7,6 +7,7 @@ from rest_framework.schemas import coreapi, get_schema_view, openapi
|
|||
|
||||
class GetSchemaViewTests(TestCase):
|
||||
"""For the get_schema_view() helper."""
|
||||
|
||||
def test_openapi(self):
|
||||
schema_view = get_schema_view(title="With OpenAPI")
|
||||
assert isinstance(schema_view.initkwargs['schema_generator'], openapi.SchemaGenerator)
|
||||
|
@ -18,3 +19,11 @@ class GetSchemaViewTests(TestCase):
|
|||
schema_view = get_schema_view(title="With CoreAPI")
|
||||
assert isinstance(schema_view.initkwargs['schema_generator'], coreapi.SchemaGenerator)
|
||||
assert renderers.CoreAPIOpenAPIRenderer in schema_view.cls().renderer_classes
|
||||
|
||||
def test_tag_objects(self):
|
||||
schema_view = get_schema_view(
|
||||
title="With OpenAPI",
|
||||
tag_objects=[{'name': 'pet', 'description': 'store description'}]
|
||||
)
|
||||
assert schema_view.initkwargs['schema_generator'].tag_objects, [
|
||||
{'name': 'pet', 'description': 'store description'}]
|
||||
|
|
Loading…
Reference in New Issue
Block a user