Skip to content

Commit

Permalink
Expand docs. Add e-soh
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Sep 24, 2024
1 parent 160db2b commit 7033467
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,73 @@ Debug logging will show every request and it's status:
- <span style="color:green">.</span><span style="color:red">F</span><span style="color:green">...</span><span style="color:red">FF<span style="color:green">.</span><span style="color:red">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF<span style="color:green">.</span><span style="color:red">FFF<span style="color:green">......</span><span style="color:red">FF<span style="color:green">.........................................</span>F<span style="color:green">...............F<span style="color:green">................................................</span>
- [UK metoffice](https://labs.metoffice.gov.uk/edr)
- fails due to /{service_id}/collections, /{service_id}/conformance?
- [E-soh](https://esoh.met.no/)
<https://api.esoh.met.no/>

### Use it for production

Not production ready.
Run manually as noted in [Test it out](#test-it-out), or add it to your CI using one of these examples:

- [Tox](https://github.com/metno/edrisobaric/blob/main/tox.ini)
- [Github actions running tox](https://github.com/metno/edrisobaric/blob/main/.github/workflows/tests.yml)
- [Gitlab CI](https://github.com/metno/edrisobaric/blob/main/.gitlab-ci.yml)

## Overview of architecture

## Documentation

Schemathesis and pytest are the main components. Stateful tests are not used, as they require openapi links in the spec.
### How to read results

A typical result looks like this:

```bash
...
PASSED sedr/schemat.py::test_locations[GET /collections/observations/position]
PASSED sedr/schemat.py::test_locations[GET /collections/observations/area]
PASSED sedr/schemat.py::test_locations[GET /collections/observations/items]
PASSED sedr/schemat.py::test_locations[GET /collections/observations/items/{item_id}]
FAILED sedr/schemat.py::test_api[GET /collections/observations/locations] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_api[GET /collections/observations/locations/{location_id}] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_api[GET /collections/observations/position] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_api[GET /collections/observations/area] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_api[GET /collections/observations/items] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_api[GET /collections/observations/items/{item_id}] - AssertionError: Request to https://api.esoh.met.no/collections/observations/items/0 failed: Custom check failed...
FAILED sedr/schemat.py::test_positions[GET /collections/observations/position] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
FAILED sedr/schemat.py::test_locations[GET /collections/observations/locations] - ExceptionGroup: Hypothesis found 5 distinct failures in explicit examples. (5 sub-exceptions)
========================================== 8 failed, 34 passed in 49.41s ===========================================
```

For each "FAILED" line, you can scroll back to see the full error and, if relevant, with a curl-example to reproduce it.

```python
| assert "name" in json.loads(
| ^^^^^^^^^^^^^^^^^^^^^
| AssertionError: Expected "name": "locations" in /locations, didn't find "name".
| Falsifying explicit example: test_locations(
| case=Case(query={'bbox': '5.0,52.0,6.0,52.1', 'datetime': '2022-01-01T00:00Z', 'parameter-name': 'wind_from_direction:2.0:mean:PT10M,wind_speed:10:mean:PT10M,relative_humidity:2.0:mean:PT1M,air_pressure_at_sea_level:1:mean:PT1M,air_temperature:1.5:maximum:PT10M', 'standard_names': 'wind_from_direction,wind_speed,relative_humidity,air_pressure_at_sea_level,air_temperature', 'levels': '../10.0', 'methods': 'mean, maximum, minimum', 'periods': ''}),
| )
```

Here you can see that the test failed due to missing a "name" field in the response.

### Components

- Python 3
- [Schemathesis](https://schemathesis.readthedocs.io/en/stable/), which use pytest to run
Main components of the validator are:

- [Schemathesis](https://schemathesis.readthedocs.io/en/stable/)
- [hypothesis}](https://hypothesis.readthedocs.io/en/latest/)
- [pytest](https://docs.pytest.org/en/stable/)

### Limitations

- Openapi 3.1
- OGC EDR API version 1.1
- Very basic tests for now
- Assuming Openapi 3.1
- Assuming OGC EDR API version 1.1
- Basic tests for now
- Profiles are not yet supported

## How to contribute

Create an issue or start a discussion. Please do not contriute without discussing it first, as this is just a proof of concept.
Create an issue or start a discussion. Please do not contriute without discussing it first.

## Documentation Template

Expand Down

0 comments on commit 7033467

Please sign in to comment.