Skip to content

Commit

Permalink
Assert consistency of map layers between map JSON and DB
Browse files Browse the repository at this point in the history
  • Loading branch information
jirik committed Sep 7, 2023
1 parent 3416991 commit d0d65ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/asserts/final/publication/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
Action(internal.mandatory_keys_in_primary_db_schema_of_actor, {}),
Action(internal.other_keys_not_in_primary_db_schema_of_actor, {}),
Action(internal.mandatory_keys_in_all_sources_of_actor, {}),
Action(internal.consistent_internal_map_layers, {}),
Action(rest.is_complete_in_rest, {}),
Action(rest.mandatory_keys_in_rest, {}),
]
Expand Down
12 changes: 11 additions & 1 deletion tests/asserts/final/publication/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
from layman.common import bbox as bbox_util
from layman.common.prime_db_schema import publications
from layman.layer import LAYER_TYPE, util as layer_util
from layman.map import MAP_TYPE
from layman.layer.filesystem import gdal, input_file
from layman.map import MAP_TYPE, util as map_util
from layman.map.filesystem import input_file as map_input_file
from test_tools import process_client, util as test_util, assert_util
from ... import util

Expand Down Expand Up @@ -451,3 +452,12 @@ def wfs_wms_status_available(workspace, publ_type, name):
publ_info = layman_util.get_publication_info(workspace, publ_type, name, {'keys': ['wfs_wms_status']})
wfs_wms_status = publ_info['_wfs_wms_status']
assert wfs_wms_status == settings.EnumWfsWmsStatus.AVAILABLE


def consistent_internal_map_layers(workspace, publ_type, name):
with app.app_context():
pub_info = layman_util.get_publication_info(workspace, publ_type, name, {'keys': ['map_layers']})
map_json = map_input_file.get_map_json(workspace, name)
layers_from_file = map_util.get_layers_from_json(map_json)
layers_from_info = {(ml['workspace'], ml['name'], ml['index']) for ml in pub_info['_map_layers']}
assert layers_from_file == layers_from_info

0 comments on commit d0d65ab

Please sign in to comment.