diff --git a/openeo/rest/connection.py b/openeo/rest/connection.py index 3e5e1f6bf..58b9c7edf 100644 --- a/openeo/rest/connection.py +++ b/openeo/rest/connection.py @@ -1132,12 +1132,10 @@ def _build_request_with_process_graph(self, process_graph: Union[dict, Any], **k """ result = kwargs process_graph = as_flat_graph(process_graph) - if self._api_version.at_least("1.0.0"): - if "process_graph" not in process_graph: - process_graph = {"process_graph": process_graph} - result["process"] = process_graph - else: - result["process_graph"] = process_graph + assert self._api_version.at_least("1.0.0") + if "process_graph" not in process_graph: + process_graph = {"process_graph": process_graph} + result["process"] = process_graph return result # TODO: unify `download` and `execute` better: e.g. `download` always writes to disk, `execute` returns result (raw or as JSON decoded dict) diff --git a/tests/rest/test_connection.py b/tests/rest/test_connection.py index ab589c63a..b60f0bf88 100644 --- a/tests/rest/test_connection.py +++ b/tests/rest/test_connection.py @@ -1967,18 +1967,6 @@ def test_default_timeout(requests_mock): assert conn.get("/foo", timeout=5).json() == '5' -def test_execute_042(requests_mock): - requests_mock.get(API_URL, json={"api_version": "0.4.2"}) - conn = Connection(API_URL) - with mock.patch.object(conn, "request") as request: - conn.execute({"foo1": {"process_id": "foo"}}) - assert request.call_args_list == [ - mock.call( - "post", path="/result", allow_redirects=False, expected_status=200, - json={"process_graph": {"foo1": {"process_id": "foo"}}} - ) - ] - @pytest.mark.parametrize("pg", [ {"foo1": {"process_id": "foo"}}, diff --git a/tests/test_usecase1.py b/tests/test_usecase1.py index 69cbb7de0..4f3e1bcd2 100644 --- a/tests/test_usecase1.py +++ b/tests/test_usecase1.py @@ -9,7 +9,10 @@ @requests_mock.mock() class TestUsecase1(TestCase): - _capabilities = {"api_version": "0.4.0", "endpoints": [{"path": "/credentials/basic", "methods": ["GET"]}]} + _capabilities = { + "api_version": "1.0.0", + "endpoints": [{"path": "/credentials/basic", "methods": ["GET"]}], + } def setUp(self): # configuration phase: define username, endpoint, parameters?