Skip to content

Commit

Permalink
Add tests for ogcapi10
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Nov 29, 2024
1 parent 37e926b commit 8aabede
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sedr/test_edreq12.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Unit tests for test_edreq12.py."""
"""Unit tests for edreq12.py."""

import unittest
import json
Expand Down
35 changes: 35 additions & 0 deletions sedr/test_ogcapi10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Unit tests for ogcapi10.py."""

import unittest
import json
import util
import ogcapi10 as ogcapi


class TestOGCAPI(unittest.TestCase):
__version__ = "testversion"
util.args = util.parse_args(["--url", "https://example.com/"], __version__)
util.logger = util.set_up_logging(
args=util.args, logfile=util.args.log_file, version=__version__
)

def test_requirement9_1(self):
# Good tests
jsondata = {}
with open("testdata/edrisobaric_landing.json", "r", encoding="utf-8") as f:
jsondata = json.load(f)
ok, _ = ogcapi.requirement9_1(jsondata)
self.assertTrue(ok)

# Bad tests
jsondata = {}
with open(
"testdata/edrisobaric_landing-bad-desc.json", "r", encoding="utf-8"
) as f:
jsondata = json.load(f)
ok, _ = ogcapi.requirement9_1(jsondata)
self.assertFalse(ok)


if __name__ == "__main__":
unittest.main()
1 change: 0 additions & 1 deletion testdata/edrisobaric_landing-bad-desc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"title": "EDR isobaric from Grib",
"description": "An EDR API for isobaric data from Grib files",
"links": [
{
"href": "https://edrisobaric.k8s.met.no/",
Expand Down

0 comments on commit 8aabede

Please sign in to comment.