Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing 'example' in describe_processes #1430

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygeoapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@ def describe_processes(self, request: Union[APIRequest, Any],
if process is None:
p2.pop('inputs')
p2.pop('outputs')
p2.pop('example')
p2.pop('example', None)

p2['jobControlOptions'] = ['sync-execute']
if self.manager.is_async:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,16 @@ def test_describe_processes(config, api_):
assert data['code'] == 'NoSuchProcess'
assert rsp_headers['Content-Type'] == FORMAT_TYPES[F_JSON]

# Test describe doesn't crash if example is missing
req = mock_request()
processor = api_.manager.get_processor("hello-world")
example = processor.metadata.pop("example")
rsp_headers, code, response = api_.describe_processes(req)
processor.metadata['example'] = example
data = json.loads(response)
assert code == HTTPStatus.OK
assert len(data['processes']) == 2


def test_execute_process(config, api_):
req_body_0 = {
Expand Down
Loading