-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from analogue/fix_swagger12_regression
Fix regression with Swagger 1.2 specs - #43
- Loading branch information
Showing
7 changed files
with
122 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
import os | ||
|
||
import pytest | ||
|
||
from swagger_spec_validator.common import SwaggerValidationError | ||
from swagger_spec_validator.validator12 import validate_json | ||
|
||
|
||
def test_success(): | ||
my_dir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
with open(os.path.join(my_dir, '../data/v1.2/foo/swagger_api.json')) as f: | ||
resource_listing = json.load(f) | ||
validate_json(resource_listing, 'schemas/v1.2/resourceListing.json') | ||
|
||
with open(os.path.join(my_dir, '../data/v1.2/foo/foo.json')) as f: | ||
api_declaration = json.load(f) | ||
validate_json(api_declaration, 'schemas/v1.2/apiDeclaration.json') | ||
|
||
|
||
def test_failure(): | ||
with pytest.raises(SwaggerValidationError) as excinfo: | ||
validate_json({}, 'schemas/v1.2/apiDeclaration.json') | ||
assert "'swaggerVersion' is a required property" in str(excinfo.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters