Skip to content

Commit

Permalink
Issue #130 disable auto_validation explicitly now
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Oct 27, 2023
1 parent cfab5ee commit e89e7d8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is roughly based on [Keep a Changelog](https://keepachangelog.com/en/
- Add (optional) config for collection id whitelisting.
Keep union of all "upstream" collections as default.
([#129](https://github.com/Open-EO/openeo-aggregator/issues/129))
- Disable `auto_validation` feature of latest `openeo` python client library release ([#130](https://github.com/Open-EO/openeo-aggregator/issues/130))


## [0.11.x]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
install_requires=[
"requests",
"attrs",
"openeo>=0.17.0,<0.24.0",
"openeo>=0.24.0",
"openeo_driver>=0.68.1.dev",
"flask~=2.0",
"gunicorn~=20.0",
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_aggregator/about.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import sys

__version__ = "0.12.1a1"
__version__ = "0.12.2a1"


def log_version_info():
Expand Down
4 changes: 3 additions & 1 deletion src/openeo_aggregator/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def __init__(
):
# Temporarily unlock `_auth` for `super().__init__()`
self._auth_locked = False
super(BackendConnection, self).__init__(url, default_timeout=init_timeout, slow_response_threshold=1)
super(BackendConnection, self).__init__(
url, default_timeout=init_timeout, slow_response_threshold=1, auto_validate=False
)
self._auth = None
self._auth_locked = True

Expand Down
1 change: 1 addition & 0 deletions src/openeo_aggregator/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def capabilities(
{"path": "/collections", "methods": ["GET"]},
{"path": "/collections/{collection_id}", "methods": ["GET"]},
{"path": "/processes", "methods": ["GET"]},
{"path": "/validation", "methods": ["POST"]},
],
"links": [],
}
Expand Down
26 changes: 26 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,32 @@ def post_jobs(request: requests.Request, context):
"b2": (0, 1),
}[expected]

def test_create_job_no_auto_validation(self, api100, requests_mock, backend1, caplog):
requests_mock.get(backend1 + "/collections", json={"collections": [{"id": "S2"}]})

jobs = []

def post_jobs(request: requests.Request, context):
nonlocal jobs
jobs.append(request.json())
context.headers["Location"] = backend1 + "/jobs/th3j0b"
context.headers["OpenEO-Identifier"] = "th3j0b"
context.status_code = 201

requests_mock.post(backend1 + "/jobs", text=post_jobs)
validation_mock = requests_mock.post(
backend1 + "/validation", status_code=500, json={"code": "Internal", "message": "Validation says no"}
)

pg = {"lc": {"process_id": "load_collection", "arguments": {"id": "S2"}, "result": True}}
api100.set_auth_bearer_token(token=TEST_USER_BEARER_TOKEN)
res = api100.post("/jobs", json={"process": {"process_graph": pg}}).assert_status_code(201)
assert res.headers["Location"] == "http://oeoa.test/openeo/1.0.0/jobs/b1-th3j0b"
assert res.headers["OpenEO-Identifier"] == "b1-th3j0b"
assert jobs == [{"process": {"process_graph": pg}}]
assert "Validation says no" not in caplog.text
assert validation_mock.call_count == 0

def test_get_job_metadata(self, api100, requests_mock, backend1):
requests_mock.get(backend1 + "/jobs/th3j0b", json={
"id": "th3j0b",
Expand Down

0 comments on commit e89e7d8

Please sign in to comment.