diff --git a/sedr/rodeoprofile10.py b/sedr/rodeoprofile10.py index e7731e0..ce9f5b3 100644 --- a/sedr/rodeoprofile10.py +++ b/sedr/rodeoprofile10.py @@ -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, + "", + ) diff --git a/sedr/schemat.py b/sedr/schemat.py index fac51a4..b65c82f 100644 --- a/sedr/schemat.py +++ b/sedr/schemat.py @@ -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 diff --git a/sedr/test_schemat.py b/sedr/test_schemat.py index 8d05240..d7959d2 100644 --- a/sedr/test_schemat.py +++ b/sedr/test_schemat.py @@ -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(