Skip to content

Commit 7d11a4e

Browse files
committed
Merge branch 'fix-federation-for-services'
2 parents a6a3bc9 + 12650be commit 7d11a4e

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
- `DataCube.sar_backscatter()`: add corresponding band names to metadata when enabling "mask", "contributing_area", "local_incidence_angle" or "ellipsoid_incidence_angle" ([#804](https://github.com/Open-EO/openeo-python-client/issues/804))
2121
- Proactively refresh access/bearer token in `MultiBackendJobManager` before launching a job start thread ([#817](https://github.com/Open-EO/openeo-python-client/issues/817))
22+
- `Connection.list_services()`: Fix list access error for federation extension
2223

2324

2425
## [0.45.0] - 2025-09-17

openeo/rest/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,12 @@ def list_services(self) -> list:
848848
:return: data_dict: Dict All available services
849849
"""
850850
# TODO return parsed service objects
851-
services = self.get('/services', expected_status=200).json()["services"]
852-
federation_missing = federation_extension.get_federation_missing(data=services, resource_name="services")
851+
response = self.get("/services", expected_status=200).json()
852+
federation_missing = federation_extension.get_federation_missing(data=response, resource_name="services")
853853
federation = self.capabilities().ext_federation_backend_details()
854854
return VisualList(
855855
"data-table",
856-
data=services,
856+
data=response["services"],
857857
parameters={"columns": "services", "missing": federation_missing, "federation": federation},
858858
)
859859

tests/rest/test_connection.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,6 +3810,63 @@ def test_list_service_types_error(requests_mock):
38103810
assert m.call_count == 2
38113811

38123812

3813+
def test_list_services(requests_mock):
3814+
requests_mock.get(API_URL, json={"api_version": "1.0.0"})
3815+
conn = Connection(API_URL)
3816+
requests_mock.get(
3817+
API_URL + "services",
3818+
json={
3819+
"services": [
3820+
{
3821+
"id": "wms-a3cca9",
3822+
"url": "https://openeo.example/wms/wms-a3cca9",
3823+
"type": "wms",
3824+
"enabled": True,
3825+
}
3826+
],
3827+
"links": [],
3828+
},
3829+
)
3830+
assert conn.list_services() == [
3831+
{
3832+
"id": "wms-a3cca9",
3833+
"url": "https://openeo.example/wms/wms-a3cca9",
3834+
"type": "wms",
3835+
"enabled": True,
3836+
}
3837+
]
3838+
3839+
3840+
def test_list_services_federation_missing(requests_mock):
3841+
requests_mock.get(API_URL, json={"api_version": "1.0.0"})
3842+
conn = Connection(API_URL)
3843+
requests_mock.get(
3844+
API_URL + "services",
3845+
json={
3846+
"services": [
3847+
{
3848+
"id": "wms-a3cca9",
3849+
"url": "https://openeo.example/wms/wms-a3cca9",
3850+
"type": "wms",
3851+
"enabled": True,
3852+
}
3853+
],
3854+
"links": [],
3855+
"federation:missing": ["oeob"],
3856+
},
3857+
)
3858+
services = conn.list_services()
3859+
assert services == [
3860+
{
3861+
"id": "wms-a3cca9",
3862+
"url": "https://openeo.example/wms/wms-a3cca9",
3863+
"type": "wms",
3864+
"enabled": True,
3865+
}
3866+
]
3867+
assert services.parameters["missing"] == ["oeob"]
3868+
3869+
38133870
def test_list_udf_runtimes(requests_mock):
38143871
requests_mock.get(API_URL, json={"api_version": "1.0.0"})
38153872
conn = Connection(API_URL)

0 commit comments

Comments
 (0)