8
8
from django .test .utils import override_settings
9
9
from django .urls import path
10
10
11
- from rest_framework .compat import uritemplate , yaml
11
+ from rest_framework .compat import coreapi , uritemplate , yaml
12
12
from rest_framework .management .commands import generateschema
13
13
from rest_framework .utils import formatting , json
14
14
from rest_framework .views import APIView
@@ -91,6 +91,7 @@ def test_writes_schema_to_file_on_parameter(self):
91
91
os .remove (path )
92
92
93
93
@pytest .mark .skipif (yaml is None , reason = 'PyYAML is required.' )
94
+ @pytest .mark .skipif (coreapi is None , reason = 'coreapi is required.' )
94
95
@override_settings (REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS' : 'rest_framework.schemas.AutoSchema' })
95
96
def test_coreapi_renders_default_schema_with_custom_title_url_and_description (self ):
96
97
expected_out = """info:
@@ -113,6 +114,7 @@ def test_coreapi_renders_default_schema_with_custom_title_url_and_description(se
113
114
114
115
self .assertIn (formatting .dedent (expected_out ), self .out .getvalue ())
115
116
117
+ @pytest .mark .skipif (coreapi is None , reason = 'coreapi is required.' )
116
118
@override_settings (REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS' : 'rest_framework.schemas.AutoSchema' })
117
119
def test_coreapi_renders_openapi_json_schema (self ):
118
120
expected_out = {
@@ -142,6 +144,7 @@ def test_coreapi_renders_openapi_json_schema(self):
142
144
143
145
self .assertDictEqual (out_json , expected_out )
144
146
147
+ @pytest .mark .skipif (coreapi is None , reason = 'coreapi is required.' )
145
148
@override_settings (REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS' : 'rest_framework.schemas.AutoSchema' })
146
149
def test_renders_corejson_schema (self ):
147
150
expected_out = """{"_type":"document","":{"list":{"_type":"link","url":"/","action":"get"}}}"""
0 commit comments