Skip to content
Open
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
6 changes: 4 additions & 2 deletions pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$schema: https://json-schema.org/draft/2020-12/schema
$id: https://raw.githubusercontent.com/geopython/pygeoapi/master/pygeoapi/schemas/config/pygeoapi-config-0.x.yml
$id: https://raw.githubusercontent.com/geopython/pygeoapi/refs/heads/master/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml
title: pygeoapi configuration schema
description: pygeoapi configuration schema

Expand Down Expand Up @@ -132,7 +132,9 @@ properties:
type: string
description: plugin name (see `pygeoapi.plugin` for supported process_managers)
connection:
type: string
oneOf:
- type: string
- type: object
description: connection info to store jobs (e.g. filepath)
output_dir:
type: string
Expand Down
36 changes: 36 additions & 0 deletions tests/other/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,39 @@ def test_validate_config(config):
}
with pytest.raises(ValidationError):
validate_config(cfg_copy)


def test_validate_config_process_manager(config):
"""
Test that the process manager config can be validated
as both a string or an object (i.e. PostgreSQL or TinyDB)
"""
cfg_copy = deepcopy(config)
cfg_copy['server']['manager'] = {
'name': 'TinyDB',
'connection': '/tmp/pygeoapi_test.db',
'output_dir': '/tmp/',
}
assert validate_config(cfg_copy)

with pytest.raises(ValidationError):
# make sure an int is validated as invalid
cfg_copy['server']['manager'] = {
'name': 'TinyDB',
'connection': 12345,
'output_dir': '/tmp/',
}
validate_config(cfg_copy)

cfg_copy['server']['manager'] = {
'name': 'PostgreSQL',
'connection': {
'host': 'localhost',
'port': 5432,
'database': 'pygeoapi',
'user': 'pygeoapi',
'password': 'pygeoapi',
},
'output_dir': '/tmp/',
}
assert validate_config(cfg_copy)