Skip to content

Commit

Permalink
Handle missing 'example' in describe_processes
Browse files Browse the repository at this point in the history
Fixes #1424
  • Loading branch information
totycro committed Dec 14, 2023
1 parent 4e19b77 commit 01f1b83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 01f1b83

Please sign in to comment.