-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from ._impl import PathAlias, origin_aliases, rhui_aliases | ||
from ._impl import PathAlias, origin_aliases, rhui_aliases, load_data | ||
|
||
__all__ = ["PathAlias", "origin_aliases", "rhui_aliases"] | ||
__all__ = ["PathAlias", "origin_aliases", "rhui_aliases", "load_data"] |
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,14 @@ | ||
import os | ||
import json | ||
from .. import load_data | ||
|
||
|
||
def schema(): | ||
with open( | ||
os.path.join(os.path.dirname(os.path.dirname(__file__)), "schema.json") | ||
) as f: | ||
return json.load(f) | ||
|
||
|
||
def data(source=None): | ||
return load_data(source) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pytest | ||
jsonschema | ||
PyYAML | ||
mock |
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,26 @@ | ||
import json | ||
import os | ||
|
||
from cdn_definitions import api | ||
|
||
|
||
def test_load_schema_api(): | ||
schema = api.schema() | ||
with open( | ||
os.path.join( | ||
os.path.dirname(os.path.dirname(__file__)), | ||
"src", | ||
"cdn_definitions", | ||
"schema.json", | ||
) | ||
) as f: | ||
local_schema = json.load(f) | ||
assert schema == local_schema | ||
|
||
|
||
def test_load_data_api(tmpdir): | ||
json_file = tmpdir.join("myfile.json") | ||
json_file.write('{"hello": "world"}') | ||
data = api.data(source=str(json_file)) | ||
assert data == {"hello": "world"} | ||
|
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