4
4
from openapi_spec_validator import OpenAPIV30SpecValidator
5
5
from openapi_spec_validator import openapi_v2_spec_validator
6
6
from openapi_spec_validator import openapi_v30_spec_validator
7
+ from openapi_spec_validator import validate
7
8
from openapi_spec_validator import validate_spec
8
9
from openapi_spec_validator import validate_spec_url
10
+ from openapi_spec_validator import validate_url
9
11
from openapi_spec_validator .validation .exceptions import OpenAPIValidationError
10
12
from openapi_spec_validator .validation .exceptions import ValidatorDetectError
11
13
@@ -15,7 +17,7 @@ def test_spec_schema_version_not_detected(self):
15
17
spec = {}
16
18
17
19
with pytest .raises (ValidatorDetectError ):
18
- validate_spec (spec )
20
+ validate (spec )
19
21
20
22
21
23
class TestLocalValidateSpecUrl :
@@ -24,7 +26,7 @@ def test_spec_schema_version_not_detected(self, factory):
24
26
spec_url = factory .spec_file_url (spec_path )
25
27
26
28
with pytest .raises (ValidatorDetectError ):
27
- validate_spec_url (spec_url )
29
+ validate_url (spec_url )
28
30
29
31
30
32
class TestLiocalValidatev2Spec :
@@ -43,8 +45,8 @@ def test_valid(self, factory, spec_file):
43
45
spec_path = self .local_test_suite_file_path (spec_file )
44
46
spec = factory .spec_from_file (spec_path )
45
47
46
- validate_spec (spec )
47
- validate_spec (spec , cls = OpenAPIV2SpecValidator )
48
+ validate (spec )
49
+ validate (spec , cls = OpenAPIV2SpecValidator )
48
50
with pytest .warns (DeprecationWarning ):
49
51
validate_spec (spec , validator = openapi_v2_spec_validator )
50
52
@@ -59,7 +61,7 @@ def test_falied(self, factory, spec_file):
59
61
spec = factory .spec_from_file (spec_path )
60
62
61
63
with pytest .raises (OpenAPIValidationError ):
62
- validate_spec (spec , cls = OpenAPIV2SpecValidator )
64
+ validate (spec , cls = OpenAPIV2SpecValidator )
63
65
with pytest .warns (DeprecationWarning ):
64
66
with pytest .raises (OpenAPIValidationError ):
65
67
validate_spec (spec , validator = openapi_v2_spec_validator )
@@ -82,9 +84,10 @@ def test_valid(self, factory, spec_file):
82
84
spec = factory .spec_from_file (spec_path )
83
85
spec_url = factory .spec_file_url (spec_path )
84
86
85
- validate_spec (spec )
86
- validate_spec (spec , spec_url = spec_url )
87
- validate_spec (spec , cls = OpenAPIV30SpecValidator )
87
+ validate (spec )
88
+ with pytest .warns (DeprecationWarning ):
89
+ validate_spec (spec , spec_url = spec_url )
90
+ validate (spec , cls = OpenAPIV30SpecValidator )
88
91
with pytest .warns (DeprecationWarning ):
89
92
validate_spec (spec , validator = openapi_v30_spec_validator )
90
93
@@ -99,7 +102,7 @@ def test_falied(self, factory, spec_file):
99
102
spec = factory .spec_from_file (spec_path )
100
103
101
104
with pytest .raises (OpenAPIValidationError ):
102
- validate_spec (spec , cls = OpenAPIV30SpecValidator )
105
+ validate (spec , cls = OpenAPIV30SpecValidator )
103
106
with pytest .warns (DeprecationWarning ):
104
107
with pytest .raises (OpenAPIValidationError ):
105
108
validate_spec (spec , validator = openapi_v30_spec_validator )
@@ -128,9 +131,10 @@ def remote_test_suite_file_path(self, test_file):
128
131
def test_valid (self , spec_file ):
129
132
spec_url = self .remote_test_suite_file_path (spec_file )
130
133
131
- validate_spec_url (spec_url )
132
- validate_spec_url (spec_url , cls = OpenAPIV2SpecValidator )
134
+ validate_url (spec_url )
135
+ validate_url (spec_url , cls = OpenAPIV2SpecValidator )
133
136
with pytest .warns (DeprecationWarning ):
137
+ validate_spec_url (spec_url )
134
138
validate_spec_url (spec_url , validator = openapi_v2_spec_validator )
135
139
136
140
@@ -157,7 +161,7 @@ def remote_test_suite_file_path(self, test_file):
157
161
def test_valid (self , spec_file ):
158
162
spec_url = self .remote_test_suite_file_path (spec_file )
159
163
160
- validate_spec_url (spec_url )
161
- validate_spec_url (spec_url , cls = OpenAPIV30SpecValidator )
164
+ validate_url (spec_url )
165
+ validate_url (spec_url , cls = OpenAPIV30SpecValidator )
162
166
with pytest .warns (DeprecationWarning ):
163
167
validate_spec_url (spec_url , validator = openapi_v30_spec_validator )
0 commit comments