9
9
InvalidContentType ,
10
10
)
11
11
from openapi_core .extensions .models .models import BaseModel
12
- from openapi_core .schema .operations .exceptions import InvalidOperation
13
12
from openapi_core .schema .parameters .exceptions import MissingRequiredParameter
14
- from openapi_core .schema .paths .exceptions import InvalidPath
15
13
from openapi_core .schema .request_bodies .exceptions import MissingRequestBody
16
14
from openapi_core .schema .responses .exceptions import (
17
15
MissingResponseContent , InvalidResponse ,
18
16
)
19
- from openapi_core .schema .servers .exceptions import InvalidServer
20
17
from openapi_core .shortcuts import create_spec
18
+ from openapi_core .templating .paths .exceptions import (
19
+ PathNotFound , OperationNotFound ,
20
+ )
21
21
from openapi_core .testing import MockRequest , MockResponse
22
22
from openapi_core .unmarshalling .schemas .exceptions import InvalidSchemaValue
23
23
from openapi_core .validation .exceptions import InvalidSecurity
@@ -56,7 +56,7 @@ def test_request_server_error(self, validator):
56
56
result = validator .validate (request )
57
57
58
58
assert len (result .errors ) == 1
59
- assert type (result .errors [0 ]) == InvalidServer
59
+ assert type (result .errors [0 ]) == PathNotFound
60
60
assert result .body is None
61
61
assert result .parameters is None
62
62
@@ -66,7 +66,7 @@ def test_invalid_path(self, validator):
66
66
result = validator .validate (request )
67
67
68
68
assert len (result .errors ) == 1
69
- assert type (result .errors [0 ]) == InvalidPath
69
+ assert type (result .errors [0 ]) == PathNotFound
70
70
assert result .body is None
71
71
assert result .parameters is None
72
72
@@ -76,7 +76,7 @@ def test_invalid_operation(self, validator):
76
76
result = validator .validate (request )
77
77
78
78
assert len (result .errors ) == 1
79
- assert type (result .errors [0 ]) == InvalidOperation
79
+ assert type (result .errors [0 ]) == OperationNotFound
80
80
assert result .body is None
81
81
assert result .parameters is None
82
82
@@ -428,18 +428,18 @@ def test_invalid_server(self, validator):
428
428
result = validator .validate (request , response )
429
429
430
430
assert len (result .errors ) == 1
431
- assert type (result .errors [0 ]) == InvalidServer
431
+ assert type (result .errors [0 ]) == PathNotFound
432
432
assert result .data is None
433
433
assert result .headers is None
434
434
435
435
def test_invalid_operation (self , validator ):
436
- request = MockRequest (self .host_url , 'get ' , '/v1' )
436
+ request = MockRequest (self .host_url , 'patch ' , '/v1/pets ' )
437
437
response = MockResponse ('Not Found' , status_code = 404 )
438
438
439
439
result = validator .validate (request , response )
440
440
441
441
assert len (result .errors ) == 1
442
- assert type (result .errors [0 ]) == InvalidPath
442
+ assert type (result .errors [0 ]) == OperationNotFound
443
443
assert result .data is None
444
444
assert result .headers is None
445
445
0 commit comments