forked from Yelp/swagger_spec_validator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression with Swagger 1.2 specs - Yelp#43
- Loading branch information
Semir Patel
committed
Nov 18, 2015
1 parent
e497494
commit 06d025e
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