Skip to content

Commit 12650be

Browse files
committed
Add tests about list_services with federation support #821
1 parent 8f558d8 commit 12650be

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

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)