Skip to content

Commit

Permalink
ServiceMetadata: more optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Dec 1, 2022
1 parent 4cfc8eb commit db776ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openeo_driver/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.27.0a1"
__version__ = "0.27.1a1"
8 changes: 4 additions & 4 deletions openeo_driver/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class ServiceMetadata(NamedTuple):

# Required fields (no default)
id: str
process: dict # TODO: also encapsulate this "process graph with metadata" struct (instead of free-form dict)?
url: str
type: str
enabled: bool
attributes: dict
configuration: dict
process: dict = None # TODO: also encapsulate this "process graph with metadata" struct (instead of free-form dict)?
enabled: bool = True # TODO: required or with default True? https://github.com/Open-EO/openeo-api/issues/473
attributes: dict = None
configuration: dict = None

# Optional fields (with default)
title: str = None
Expand Down
12 changes: 12 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def test_user_defined_process_metadata_from_dict_extra():
assert udp.description == "Enhance the image with the foo process."


def test_service_metadata_from_dict_essentials():
service = ServiceMetadata.from_dict(
{"id": "badcafe", "url": "https://oeo.test/srv/f00b67", "type": "WMTS"}
)
assert service.id == "badcafe"
assert service.url == "https://oeo.test/srv/f00b67"
assert service.type == "WMTS"
assert service.enabled is True
assert service.process is None
assert service.attributes is None
assert service.configuration is None

def test_service_metadata_from_dict_basic():
service = ServiceMetadata.from_dict({
"id": "badcafe", "process": {"id": "ndvi", "process_graph": {}},
Expand Down

0 comments on commit db776ca

Please sign in to comment.