From 0eb4eaa89593e87fd0417f3026d549e658c5c9ed Mon Sep 17 00:00:00 2001 From: index-git Date: Mon, 25 Oct 2021 16:42:46 +0200 Subject: [PATCH] Check additional files for ShapeFile for POST zip file --- src/layman/layer/filesystem/input_file.py | 3 ++- tests/dynamic_data/publications.py | 30 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/layman/layer/filesystem/input_file.py b/src/layman/layer/filesystem/input_file.py index e369e9ab1..9a9baae17 100644 --- a/src/layman/layer/filesystem/input_file.py +++ b/src/layman/layer/filesystem/input_file.py @@ -207,7 +207,8 @@ def check_filenames(workspace, layername, filenames, check_crs, ignore_existing_ )) if len(missing_exts) > 0: detail = { - 'missing_extensions': missing_exts + 'missing_extensions': missing_exts, + 'path': main_filename, } if '.prj' in missing_exts: detail['suggestion'] = 'Missing .prj file can be fixed also ' \ diff --git a/tests/dynamic_data/publications.py b/tests/dynamic_data/publications.py index aa6049743..a91d0d117 100644 --- a/tests/dynamic_data/publications.py +++ b/tests/dynamic_data/publications.py @@ -78,6 +78,36 @@ Action(publication.internal.does_not_exist, dict()) ], }, + { + consts.KEY_ACTION: { + consts.KEY_CALL: Action(process_client.publish_workspace_publication, { + 'file_paths': [ + 'tmp/naturalearth/110m/cultural/ne_110m_admin_0_boundary_lines_land.cpg', + 'tmp/naturalearth/110m/cultural/ne_110m_admin_0_boundary_lines_land.README.html', + 'tmp/naturalearth/110m/cultural/ne_110m_admin_0_boundary_lines_land.shp', + 'tmp/naturalearth/110m/cultural/ne_110m_admin_0_boundary_lines_land.shx', + 'tmp/naturalearth/110m/cultural/ne_110m_admin_0_boundary_lines_land.VERSION.txt', + ], + 'compress': True, + }), + consts.KEY_CALL_EXCEPTION: { + consts.KEY_EXCEPTION: LaymanError, + consts.KEY_EXCEPTION_ASSERTS: [ + Action(processing.exception.response_exception, {'expected': {'http_code': 400, + 'code': 18, + 'message': 'Missing one or more ShapeFile files.', + 'detail': {'missing_extensions': ['.dbf', '.prj'], + 'suggestion': 'Missing .prj file can be fixed also by setting "crs" parameter.', + 'path': 'temporary_zip_file.zip/ne_110m_admin_0_boundary_lines_land.shp', + }, + }, }, ), + ], + }, + }, + consts.KEY_FINAL_ASSERTS: [ + Action(publication.internal.does_not_exist, dict()) + ], + }, { consts.KEY_ACTION: { consts.KEY_CALL: Action(process_client.publish_workspace_publication, {