Skip to content

Commit

Permalink
Fix compatibility with openeo>=0.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Nov 6, 2023
1 parent a4ff545 commit 8158e7d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is roughly based on [Keep a Changelog](https://keepachangelog.com/en/
Keep union of all "upstream" collections as default.
([#129](https://github.com/Open-EO/openeo-aggregator/issues/129))
- Disable `auto_validation` feature of latest `openeo` python client library release ([#130](https://github.com/Open-EO/openeo-aggregator/issues/130))
- Fix compatibility with `openeo>=0.25.0`


## [0.11.x]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
install_requires=[
"requests",
"attrs",
"openeo>=0.24.0",
"openeo>=0.25.0",
"openeo_driver>=0.68.1.dev",
"flask~=2.0",
"gunicorn~=20.0",
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_aggregator/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from typing import Optional

__version__ = "0.12.2a1"
__version__ = "0.12.3a1"


def log_version_info(logger: Optional[logging.Logger] = None):
Expand Down
13 changes: 9 additions & 4 deletions src/openeo_aggregator/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
import openeo
import openeo_driver.util.view_helpers
from openeo.capabilities import ComparableVersion
from openeo.rest import OpenEoApiError, OpenEoClientException, OpenEoRestError
from openeo.rest import (
OpenEoApiError,
OpenEoApiPlainError,
OpenEoClientException,
OpenEoRestError,
)
from openeo.util import TimingLogger, deep_get, dict_no_none
from openeo_driver.backend import (
AbstractCollectionCatalog,
Expand Down Expand Up @@ -1109,7 +1114,7 @@ def service_info(self, user_id: str, service_id: str) -> ServiceMetadata:
with con.authenticated_from_request(request=flask.request, user=User(user_id)):
try:
service_json = con.get(f"/services/{backend_service_id}").json()
except (OpenEoApiError) as e:
except OpenEoApiPlainError as e:
if e.http_status_code == 404:
# Expected error
_log.debug(f"No service with ID={service_id!r} in backend with ID={con.id!r}: {e!r}", exc_info=True)
Expand Down Expand Up @@ -1159,7 +1164,7 @@ def remove_service(self, user_id: str, service_id: str) -> None:
with con.authenticated_from_request(request=flask.request, user=User(user_id)):
try:
con.delete(f"/services/{backend_service_id}", expected_status=204)
except (OpenEoApiError) as e:
except OpenEoApiPlainError as e:
if e.http_status_code == 404:
# Expected error
_log.debug(f"No service with ID={service_id!r} in backend with ID={con.id!r}: {e!r}", exc_info=True)
Expand All @@ -1182,7 +1187,7 @@ def update_service(self, user_id: str, service_id: str, process_graph: dict) ->
try:
json = {"process": {"process_graph": process_graph}}
con.patch(f"/services/{backend_service_id}", json=json, expected_status=204)
except (OpenEoApiError) as e:
except OpenEoApiPlainError as e:
if e.http_status_code == 404:
# Expected error
_log.debug(f"No service with ID={backend_service_id!r} in backend with ID={con.id!r}: {e!r}", exc_info=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging

import pytest
from openeo.rest import OpenEoApiError, OpenEoRestError
from openeo.rest import OpenEoApiError, OpenEoApiPlainError, OpenEoRestError
from openeo_driver.backend import ServiceMetadata
from openeo_driver.errors import (
CollectionNotFoundException,
Expand Down Expand Up @@ -815,7 +815,7 @@ def test_remove_service_backend_response_is_an_error_status(
implementation = AggregatorSecondaryServices(backends=multi_backend_connection, processing=processing, config=config)

with flask_app.test_request_context(headers=TEST_USER_AUTH_HEADER):
with pytest.raises(OpenEoApiError) as e:
with pytest.raises(OpenEoApiPlainError) as e:
implementation.remove_service(user_id=TEST_USER, service_id="b1-wmts-foo")

# If the backend reports HTTP 400/500, we would expect the same status code from the aggregator.
Expand Down Expand Up @@ -895,7 +895,7 @@ def test_update_service_backend_response_is_an_error_status(
new_process_graph = {"bar": {"process_id": "bar", "arguments": {"arg1": "bar"}}}

with flask_app.test_request_context(headers=TEST_USER_AUTH_HEADER):
with pytest.raises(OpenEoApiError) as e:
with pytest.raises(OpenEoApiPlainError) as e:
implementation.update_service(user_id=TEST_USER, service_id="b1-wmts-foo", process_graph=new_process_graph)

assert e.value.http_status_code == 500
Expand Down

0 comments on commit 8158e7d

Please sign in to comment.