Skip to content

Commit ad75366

Browse files
committed
fixup! Issue #47 drop 0.4 openEO API support (from .well-known/openeo)
1 parent 577ab8d commit ad75366

File tree

3 files changed

+9
-227
lines changed

3 files changed

+9
-227
lines changed

openeo_driver/ProcessGraphDeserializer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@
6363
_log = logging.getLogger(__name__)
6464

6565
# Set up process registries (version dependent)
66+
# TODO #47 remove 0.4.0 support
6667
process_registry_040 = ProcessRegistry(spec_root=SPECS_ROOT / 'openeo-processes/0.4', argument_names=["args", "env"])
6768
process_registry_100 = ProcessRegistry(spec_root=SPECS_ROOT / 'openeo-processes/1.x', argument_names=["args", "env"])
6869

6970
# Bootstrap with some mathematical/logical processes
71+
# TODO #47 remove 0.4.0 support
7072
process_registry_040.add_spec_by_name(
7173
'array_contains', 'array_element',
7274
'count', 'first', 'last', 'order', 'rearrange', 'sort',

tests/test_views.py

Lines changed: 0 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ def api(api_version, client) -> ApiTester:
5050
return ApiTester(api_version=api_version, client=client, data_root=TEST_DATA_ROOT)
5151

5252

53-
@pytest.fixture
54-
def api040(client) -> ApiTester:
55-
return ApiTester(api_version="0.4.0", client=client, data_root=TEST_DATA_ROOT)
56-
57-
5853
@pytest.fixture
5954
def api100(client) -> ApiTester:
6055
return ApiTester(api_version="1.0.0", client=client, data_root=TEST_DATA_ROOT)
@@ -127,7 +122,6 @@ def test_well_known_openeo(self, client):
127122
by_api_version = {d["api_version"]: d for d in versions}
128123
assert len(versions) == len(by_api_version)
129124
assert by_api_version == {
130-
"0.4.2": {'api_version': '0.4.2', 'production': True, 'url': 'http://oeo.net/openeo/0.4/'},
131125
"1.0.0": {'api_version': '1.0.0', 'production': True, 'url': 'http://oeo.net/openeo/1.0/'},
132126
"1.1.0": {'api_version': '1.1.0', 'production': True, 'url': 'http://oeo.net/openeo/1.1/'},
133127
}
@@ -146,7 +140,6 @@ def test_https_proxy_handling(self, client, headers, expected):
146140
assert url.startswith(expected)
147141

148142
@pytest.mark.parametrize(["url", "expected_version"], [
149-
("/openeo/0.4/", "0.4.2"),
150143
("/openeo/1.0/", "1.0.0"),
151144
("/openeo/1.0.0/", "1.0.0"),
152145
("/openeo/1.1/", "1.1.0"),
@@ -160,14 +153,6 @@ def test_versioned_urls(self, client, url, expected_version):
160153
assert capabilities["title"] == "openEO Unit Test Dummy Backend"
161154
assert capabilities["api_version"] == expected_version
162155

163-
def test_capabilities_040(self, api040):
164-
capabilities = api040.get('/').assert_status_code(200).json
165-
assert capabilities["api_version"] == "0.4.0"
166-
assert capabilities["version"] == "0.4.0"
167-
assert capabilities["stac_version"] == "0.9.0"
168-
assert capabilities["title"] == "openEO Unit Test Dummy Backend"
169-
assert capabilities["id"] == "openeounittestdummybackend-0.4.0"
170-
assert capabilities["production"] is True
171156

172157
def test_capabilities_100(self, api100):
173158
capabilities = api100.get('/').assert_status_code(200).json
@@ -234,12 +219,6 @@ def validate(self, *args, **kwargs):
234219
endpoints = {e["path"]: sorted(e["methods"]) for e in capabilities["endpoints"]}
235220
assert "/validation" not in endpoints
236221

237-
def test_capabilities_endpoints_issue_28_v040(self, api040):
238-
"""https://github.com/Open-EO/openeo-python-driver/issues/28"""
239-
capabilities = api040.get("/").assert_status_code(200).json
240-
endpoints = {e["path"]: e["methods"] for e in capabilities["endpoints"]}
241-
assert endpoints["/output_formats"] == ["GET"]
242-
assert "/file_formats" not in endpoints
243222

244223
def test_capabilities_endpoints_issue_28_v100(self, api100):
245224
"""https://github.com/Open-EO/openeo-python-driver/issues/28"""
@@ -452,9 +431,6 @@ def health(options: Optional[dict] = None):
452431
resp = api.get('/health?shape=square&color=red').assert_status_code(200).json
453432
assert resp == {"status": "OK", "color": "red"}
454433

455-
def test_credentials_oidc_040(self, api040):
456-
resp = api040.get('/credentials/oidc').assert_status_code(303)
457-
assert resp.headers["Location"] == "https://oidc.test/.well-known/openid-configuration"
458434

459435
def test_credentials_oidc_100(self, api100):
460436
resp = api100.get('/credentials/oidc').assert_status_code(200).json
@@ -469,9 +445,6 @@ def test_credentials_oidc_100(self, api100):
469445
DictSubSet({'id': 'local'})
470446
])}
471447

472-
def test_output_formats(self, api040):
473-
resp = api040.get('/output_formats').assert_status_code(200).json
474-
assert resp == {"GTiff": {"title": "GeoTiff", "gis_data_types": ["raster"], "parameters": {}}, }
475448

476449
def test_file_formats(self, api100):
477450
response = api100.get('/file_formats')
@@ -519,17 +492,6 @@ def test_processes_non_standard_atmospheric_correction(self, api):
519492
assert spec["links"][0]["rel"] == "about"
520493
assert "DigitalElevationModelInvalid" in spec["exceptions"]
521494

522-
def test_processes_040_vs_100(self, api040, api100):
523-
pids040 = {p['id'] for p in api040.get("/processes").assert_status_code(200).json["processes"]}
524-
pids100 = {p['id'] for p in api100.get("/processes").assert_status_code(200).json["processes"]}
525-
expected_only_040 = {'aggregate_polygon'}
526-
expected_only_100 = {'reduce_dimension', 'aggregate_spatial', 'mask_polygon', 'add'}
527-
for pid in expected_only_040:
528-
assert pid in pids040
529-
assert pid not in pids100
530-
for pid in expected_only_100:
531-
assert pid not in pids040
532-
assert pid in pids100
533495

534496
def test_custom_process_listing(self, api100):
535497
process_id = generate_unique_test_process_id()
@@ -970,33 +932,6 @@ def _fresh_job_registry(next_job_id="job-1234", output_root: Optional[Path] = No
970932
)
971933
yield dummy_backend.DummyBatchJobs._job_registry
972934

973-
def test_create_job_040(self, api040):
974-
with self._fresh_job_registry(next_job_id="job-220"):
975-
resp = api040.post('/jobs', headers=self.AUTH_HEADER, json={
976-
'title': 'foo job',
977-
'process_graph': {"foo": {"process_id": "foo", "arguments": {}}},
978-
}).assert_status_code(201)
979-
assert resp.headers['Location'] == 'http://oeo.net/openeo/0.4.0/jobs/job-220'
980-
assert resp.headers['OpenEO-Identifier'] == 'job-220'
981-
job_info = dummy_backend.DummyBatchJobs._job_registry[TEST_USER, 'job-220']
982-
assert job_info.id == "job-220"
983-
assert job_info.process == {"process_graph": {"foo": {"process_id": "foo", "arguments": {}}}}
984-
assert job_info.status == "created"
985-
assert job_info.created == dummy_backend.DEFAULT_DATETIME
986-
assert job_info.job_options is None
987-
988-
def test_create_job_with_options_040(self, api040):
989-
with self._fresh_job_registry(next_job_id="job-230"):
990-
resp = api040.post('/jobs', headers=self.AUTH_HEADER, json={
991-
'title': 'foo job',
992-
'process_graph': {"foo": {"process_id": "foo", "arguments": {}}},
993-
'job_options': {"driver-memory": "3g", "executor-memory": "5g"},
994-
}).assert_status_code(201)
995-
assert resp.headers['Location'] == 'http://oeo.net/openeo/0.4.0/jobs/job-230'
996-
assert resp.headers['OpenEO-Identifier'] == 'job-230'
997-
job_info = dummy_backend.DummyBatchJobs._job_registry[TEST_USER, 'job-230']
998-
assert job_info.job_options == {"driver-memory": "3g", "executor-memory": "5g"}
999-
1000935
def test_create_job_100(self, api100):
1001936
with self._fresh_job_registry(next_job_id="job-245"):
1002937
resp = api100.post('/jobs', headers=self.AUTH_HEADER, json={
@@ -1080,16 +1015,6 @@ def test_start_job_invalid(self, api):
10801015
resp.assert_error(404, "JobNotFound")
10811016
assert resp.json["message"] == "The batch job 'deadbeef-f00' does not exist."
10821017

1083-
def test_get_job_info_040(self, api040):
1084-
with self._fresh_job_registry():
1085-
resp = api040.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc', headers=self.AUTH_HEADER)
1086-
assert resp.assert_status_code(200).json == {
1087-
'id': '07024ee9-7847-4b8a-b260-6c879a2b3cdc',
1088-
'status': 'running',
1089-
'submitted': "2017-01-01T09:32:12Z",
1090-
'process_graph': {'foo': {'process_id': 'foo', 'arguments': {}}},
1091-
}
1092-
10931018
def test_get_job_info_metrics_100(self, api100):
10941019
resp = api100.get('/jobs/53c71345-09b4-46b4-b6b0-03fd6fe1f199', headers=self.AUTH_HEADER)
10951020
assert resp.assert_status_code(200).json == {
@@ -1125,32 +1050,6 @@ def test_get_job_info_invalid(self, api):
11251050
resp = api.get('/jobs/deadbeef-f00', headers=self.AUTH_HEADER).assert_error(404, "JobNotFound")
11261051
assert resp.json["message"] == "The batch job 'deadbeef-f00' does not exist."
11271052

1128-
def test_list_user_jobs_040(self, api040):
1129-
with self._fresh_job_registry():
1130-
resp = api040.get('/jobs', headers=self.AUTH_HEADER)
1131-
assert resp.assert_status_code(200).json == {
1132-
"jobs": [
1133-
{
1134-
'id': '07024ee9-7847-4b8a-b260-6c879a2b3cdc',
1135-
'status': 'running',
1136-
'submitted': "2017-01-01T09:32:12Z",
1137-
},
1138-
{
1139-
'id': '53c71345-09b4-46b4-b6b0-03fd6fe1f199',
1140-
'title': "Your title here.",
1141-
'description': "Your description here.",
1142-
'status': 'finished',
1143-
'progress': 100,
1144-
'submitted': "2020-06-11T11:51:29Z",
1145-
'updated': "2020-06-11T11:55:15Z",
1146-
'plan': 'some_plan',
1147-
'costs': 1.23,
1148-
'budget': 4.56
1149-
}
1150-
],
1151-
"links": []
1152-
}
1153-
11541053
def test_list_user_jobs_100(self, api100):
11551054
with self._fresh_job_registry():
11561055
resp = api100.get('/jobs', headers=self.AUTH_HEADER)
@@ -1204,25 +1103,6 @@ def test_get_job_results_unfinished(self, api):
12041103
resp = api.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results', headers=self.AUTH_HEADER)
12051104
resp.assert_error(400, "JobNotFinished")
12061105

1207-
def test_get_job_results_040(self, api040):
1208-
with self._fresh_job_registry(next_job_id="job-349"):
1209-
dummy_backend.DummyBatchJobs._update_status(
1210-
job_id="07024ee9-7847-4b8a-b260-6c879a2b3cdc", user_id=TEST_USER, status="finished")
1211-
resp = api040.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results', headers=self.AUTH_HEADER)
1212-
assert resp.assert_status_code(200).json == {
1213-
"links": [
1214-
{
1215-
"href": "http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/output.tiff"
1216-
},
1217-
{
1218-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/randomforest.model'
1219-
},
1220-
{
1221-
"href": "http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/ml_model_metadata.json"
1222-
}
1223-
]
1224-
}
1225-
12261106
def test_get_job_results_100(self, api100):
12271107
with self._fresh_job_registry(next_job_id="job-362"):
12281108
dummy_backend.DummyBatchJobs._update_status(
@@ -1375,26 +1255,6 @@ def test_get_job_results_public_href_asset_100(self, api100, backend_implementat
13751255
}
13761256
}
13771257

1378-
def test_get_job_results_signed_040(self, api040, flask_app):
1379-
app_config = {'SIGNED_URL': 'TRUE', 'SIGNED_URL_SECRET': '123&@#'}
1380-
with mock.patch.dict(flask_app.config, app_config), self._fresh_job_registry():
1381-
dummy_backend.DummyBatchJobs._update_status(
1382-
job_id='07024ee9-7847-4b8a-b260-6c879a2b3cdc', user_id=TEST_USER, status='finished')
1383-
resp = api040.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results', headers=self.AUTH_HEADER)
1384-
assert resp.assert_status_code(200).json == {
1385-
'links': [
1386-
{
1387-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/50afb0cad129e61d415278c4ffcd8a83/output.tiff'
1388-
},
1389-
{
1390-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/741cfd7379a9eda4bc1c8b0c5155bfe9/randomforest.model'
1391-
},
1392-
{
1393-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/272d7aa46727ee3f11a7211d5be953e4/ml_model_metadata.json'
1394-
}
1395-
]
1396-
}
1397-
13981258
def test_get_job_results_signed_100(self, api100, flask_app):
13991259
app_config = {'SIGNED_URL': 'TRUE', 'SIGNED_URL_SECRET': '123&@#'}
14001260
with mock.patch.dict(flask_app.config, app_config), self._fresh_job_registry():
@@ -1457,27 +1317,6 @@ def test_get_job_results_signed_100(self, api100, flask_app):
14571317
'type': 'Feature'
14581318
}
14591319

1460-
@mock.patch('time.time', mock.MagicMock(return_value=1234))
1461-
def test_get_job_results_signed_with_expiration_040(self, api040, flask_app):
1462-
app_config = {'SIGNED_URL': 'TRUE', 'SIGNED_URL_SECRET': '123&@#', 'SIGNED_URL_EXPIRATION': '1000'}
1463-
with mock.patch.dict(flask_app.config, app_config), self._fresh_job_registry():
1464-
dummy_backend.DummyBatchJobs._update_status(
1465-
job_id='07024ee9-7847-4b8a-b260-6c879a2b3cdc', user_id=TEST_USER, status='finished')
1466-
resp = api040.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results', headers=self.AUTH_HEADER)
1467-
assert resp.assert_status_code(200).json == {
1468-
'links': [
1469-
{
1470-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/fd0ca65e29c6d223da05b2e73a875683/output.tiff?expires=2234'
1471-
},
1472-
{
1473-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/22b76413158c59acaccc74e74841a473/randomforest.model?expires=2234'
1474-
},
1475-
{
1476-
'href': 'http://oeo.net/openeo/0.4.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/assets/TXIuVGVzdA%3D%3D/a23629392982e57e7312e34de4bdba95/ml_model_metadata.json?expires=2234'
1477-
}
1478-
]
1479-
}
1480-
14811320
@mock.patch('time.time', mock.MagicMock(return_value=1234))
14821321
def test_get_job_results_signed_with_expiration_100(self, api100, flask_app):
14831322
app_config = {'SIGNED_URL': 'TRUE', 'SIGNED_URL_SECRET': '123&@#', 'SIGNED_URL_EXPIRATION': '1000'}
@@ -1895,21 +1734,6 @@ def test_unsupported_services_methods_return_405_MethodNotAllowed(self, api):
18951734
})
18961735
res.assert_status_code(405)
18971736

1898-
def test_list_services_040(self, api040):
1899-
metadata = api040.get('/services', headers=self.AUTH_HEADER).json
1900-
assert metadata == {
1901-
"services": [{
1902-
'id': 'wmts-foo',
1903-
'type': 'WMTS',
1904-
'enabled': True,
1905-
'url': 'https://oeo.net/wmts/foo',
1906-
'submitted': '2020-04-09T15:05:08Z',
1907-
'title': 'Test service',
1908-
'parameters': {'version': '0.5.8'},
1909-
}],
1910-
"links": []
1911-
}
1912-
19131737
def test_list_services_100(self, api100):
19141738
metadata = api100.get('/services', headers=self.AUTH_HEADER).json
19151739
assert metadata == {
@@ -1925,20 +1749,6 @@ def test_list_services_100(self, api100):
19251749
"links": []
19261750
}
19271751

1928-
def test_get_service_metadata_040(self, api040):
1929-
metadata = api040.get('/services/wmts-foo', headers=self.AUTH_HEADER).json
1930-
assert metadata == {
1931-
"id": "wmts-foo",
1932-
"process_graph": {"foo": {"process_id": "foo", "arguments": {}}},
1933-
"url": "https://oeo.net/wmts/foo",
1934-
"type": "WMTS",
1935-
"enabled": True,
1936-
"parameters": {"version": "0.5.8"},
1937-
"attributes": {},
1938-
"title": "Test service",
1939-
'submitted': '2020-04-09T15:05:08Z',
1940-
}
1941-
19421752
def test_get_service_metadata_100(self, api100):
19431753
metadata = api100.get('/services/wmts-foo', headers=self.AUTH_HEADER).json
19441754
assert metadata == {

0 commit comments

Comments
 (0)