Skip to content

Commit

Permalink
Merge pull request #20 from metno/19-implement-rodeo-profile-75-colle…
Browse files Browse the repository at this point in the history
…ction-license

19 implement rodeo profile 75 collection license
  • Loading branch information
ways authored Nov 21, 2024
2 parents 80e66ad + 0b176a3 commit 362d739
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
23 changes: 23 additions & 0 deletions sedr/rodeoprofile10.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,26 @@ def requirement7_4(jsondata: str) -> tuple[bool, str]:
True,
"",
)


def requirement7_5(jsondata: str) -> tuple[bool, str]:
"""Check collection license. Can't test D."""
spec_url = f"{spec_base_url}#_collection_license"
# A, B
for link in jsondata["links"]:
if link["rel"] == "license":
if not link["type"] == "text/html":
return (
False,
f"Collection <{jsondata['id']}> license link should have type='text/html'. See <{spec_url}> C for more info.",
)
break
else:
return (
False,
f"Collection <{jsondata['id']}> is missing a license link with rel='license'. See <{spec_url}> A, B for more info.",
)
return (
True,
"",
)
6 changes: 6 additions & 0 deletions sedr/schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ def test_edr_collections(case):
if not requirement7_4:
raise AssertionError(requirement7_4_message)

requirement7_5, requirement7_5_message = rodeoprofile.requirement7_5(
jsondata=collection
)
if not requirement7_5:
raise AssertionError(requirement7_5_message)


for p in schema.raw_schema["paths"].keys():
# Optionally include endpoints if they exist, otherwise schemathesis will refuse to run
Expand Down
2 changes: 1 addition & 1 deletion sedr/test_schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_set_up_schemathesis(self):
"""Test set_up_schemathesis."""
__version__ = "testversion"

util.args = util.parse_args([], __version__)
util.args = util.parse_args(["--url", "https://edrisobaric.k8s.met.no/"], __version__)
util.args.openapi_version == "3.1"

util.logger = util.set_up_logging(
Expand Down

0 comments on commit 362d739

Please sign in to comment.