File tree Expand file tree Collapse file tree
pygeoapi/resources/schemas/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11$schema : https://json-schema.org/draft/2020-12/schema
2- $id : https://raw.githubusercontent.com/geopython/pygeoapi/master/pygeoapi/schemas/config/pygeoapi-config-0.x.yml
2+ $id : https://raw.githubusercontent.com/geopython/pygeoapi/refs/heads/ master/pygeoapi/resources /schemas/config/pygeoapi-config-0.x.yml
33title : pygeoapi configuration schema
44description : pygeoapi configuration schema
55
@@ -132,7 +132,9 @@ properties:
132132 type : string
133133 description : plugin name (see `pygeoapi.plugin` for supported process_managers)
134134 connection :
135- type : string
135+ type :
136+ - string
137+ - object
136138 description : connection info to store jobs (e.g. filepath)
137139 output_dir :
138140 type : string
Original file line number Diff line number Diff line change @@ -99,3 +99,39 @@ def test_validate_config(config):
9999 }
100100 with pytest .raises (ValidationError ):
101101 validate_config (cfg_copy )
102+
103+
104+ def test_validate_config_process_manager (config ):
105+ """
106+ Test that the process manager config can be validated
107+ as both a string or an object (i.e. PostgreSQL or TinyDB)
108+ """
109+ cfg_copy = deepcopy (config )
110+ cfg_copy ['server' ]['manager' ] = {
111+ 'name' : 'TinyDB' ,
112+ 'connection' : '/tmp/pygeoapi_test.db' ,
113+ 'output_dir' : '/tmp/'
114+ }
115+ assert validate_config (cfg_copy )
116+
117+ with pytest .raises (ValidationError ):
118+ # make sure an int is validated as invalid
119+ cfg_copy ['server' ]['manager' ] = {
120+ 'name' : 'TinyDB' ,
121+ 'connection' : 12345 ,
122+ 'output_dir' : '/tmp/'
123+ }
124+ validate_config (cfg_copy )
125+
126+ cfg_copy ['server' ]['manager' ] = {
127+ 'name' : 'PostgreSQL' ,
128+ 'connection' : {
129+ 'host' : 'localhost' ,
130+ 'port' : 5432 ,
131+ 'database' : 'pygeoapi' ,
132+ 'user' : 'pygeoapi' ,
133+ 'password' : 'pygeoapi'
134+ },
135+ 'output_dir' : '/tmp/'
136+ }
137+ assert validate_config (cfg_copy )
You can’t perform that action at this time.
0 commit comments