Skip to content

Commit

Permalink
Added Secondary Service TODO notes for #78 #83
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Nov 28, 2022
1 parent fd6a3d7 commit 4feb389
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/openeo_aggregator/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,16 +671,18 @@ def _get_connection_and_backend_service_id(

def service_types(self) -> dict:
"""https://openeo.org/documentation/1.0/developers/api/reference.html#operation/list-service-types"""

# TODO: add caching. Also see https://github.com/Open-EO/openeo-aggregator/issues/78#issuecomment-1326180557
service_types = {}

# TODO: Instead of merge: prefix each type with backend-id? #83
def merge(formats: dict, to_add: dict):
for name, data in to_add.items():
if name.lower() not in {k.lower() for k in formats.keys()}:
formats[name] = data

# Collect all service types from the backends.
for con in self._backends:
# TODO: skip back-ends that do not support secondary services. https://github.com/Open-EO/openeo-aggregator/issues/78#issuecomment-1326180557
try:
types_to_add = con.get("/service_types").json()
except Exception as e:
Expand Down Expand Up @@ -747,6 +749,9 @@ def create_service(self, user_id: str, process_graph: dict, service_type: str, a
"""
# TODO: configuration is not used. What to do with it?

# TODO: Determine backend based on service type?
# See https://github.com/Open-EO/openeo-aggregator/issues/78#issuecomment-1326180557
# and https://github.com/Open-EO/openeo-aggregator/issues/83
backend_id = self._processing.get_backend_for_process_graph(
process_graph=process_graph, api_version=api_version
)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
from .conftest import DEFAULT_MEMOIZER_CONFIG


# TODO: "backend.py" should not really be authentication-aware, can we eliminate these constants
# and move the tested functionality to test_views.py?
# Also see https://github.com/Open-EO/openeo-aggregator/pull/79#discussion_r1022018851
TEST_USER = "Mr.Test"
TEST_USER_BEARER_TOKEN = "basic//" + HttpAuthHandler.build_basic_access_token(user_id=TEST_USER)
TEST_USER_AUTH_HEADER = {
"Authorization": "Bearer " + TEST_USER_BEARER_TOKEN
}


class TestAggregatorBackendImplementation:

def test_oidc_providers(self, multi_backend_connection, config, backend1, backend2, requests_mock):
Expand Down

0 comments on commit 4feb389

Please sign in to comment.