From c48c7f089ced5078f9c4dd3f01c3c37e91569ca7 Mon Sep 17 00:00:00 2001 From: Lars Falk-Petersen Date: Fri, 29 Nov 2024 09:45:39 +0100 Subject: [PATCH] Docs --- README.md | 16 ++++++++++++---- sedr/schemat.py | 8 ++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 47716d6..047d7d3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## What is sedr? -An experimental validator for OGC EDR APIs using schemathesis. Main focus will be on the Rodeo Profile, which is a subset of the OGC EDR API. +An experimental validator for OGC EDR APIs. Main focus will be on the Rodeo Profile, which is a subset of the OGC EDR API. ## Who is responsible? @@ -40,6 +40,10 @@ Run manually as noted in [Test it out](#test-it-out), or add it to your CI using ## Overview of architecture +- __init__ includes tests from ogcapi, edrreq and rodeoprofile at startup. Tests are categorized as landing, conformance and collection. +- Landing and conformance tests are run first, in the preflight phase. +- Then schemathesis will validate the OpenAPI spec and run lots of automatic tests, including fuzzing of query parameters. Collection tests are run during this phase. + ## Documentation ### Limitations @@ -48,9 +52,13 @@ Run manually as noted in [Test it out](#test-it-out), or add it to your CI using - Assuming OGC EDR API version 1.2 (draft) - Few, basic tests for now - Will focus more on profiles (limitations within the EDR spec) like than the full EDR spec. -- Use --rodeo-profile to force a test against the profile (will happen automatically if conformance includes the profile) +- Use --rodeo-profile to force a test against the profile + +### Testing the sedr code to look for regressions + +For development, source a venv and run `tox p` to run all tests. -### Understanding errors +### Understanding errors from schemathesis For each "FAILED" line, you can scroll back to see the full error and, if relevant, with a curl-example to reproduce it. @@ -96,7 +104,7 @@ ERROR sedr/schemat.py - schemathesis.exceptions.SchemaError: Failed to load sche #### Wrong API version / missing conformance link -Sedr supports EDR 1.1, but the API is EDR 1.0. +Sedr wants EDR 1.1, but the API is EDR 1.0. ```python if not requirementA2_2_A5: diff --git a/sedr/schemat.py b/sedr/schemat.py index 7d84ec9..f6916a7 100644 --- a/sedr/schemat.py +++ b/sedr/schemat.py @@ -115,10 +115,6 @@ def test_edr_collections(case): "test_collections found collection id %s", collection_json["id"] ) - # Validation done in requrementA5_2 - extent = util.parse_spatial_bbox(collection_json) - extents[collection_url] = tuple(extent[0]) - # Run edr, ogc, profile tests for f in util.test_functions["collection"]: status, msg = f(collection_json) @@ -127,6 +123,10 @@ def test_edr_collections(case): raise AssertionError(f"Test {f.__name__} failed with message: {msg}") util.logger.info("Test %s passed. (%s)", f.__name__, msg) + # Validation of spatial_bbox done above + extent = util.parse_spatial_bbox(collection_json) + extents[collection_url] = tuple(extent[0]) + for p in schema.raw_schema["paths"].keys(): # Optionally include endpoints if they exist, otherwise schemathesis will refuse to run