Skip to content

Commit

Permalink
Check additional files for ShapeFile for POST zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Oct 27, 2021
1 parent 356f4e5 commit 1e4e9ac
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/layman/layer/filesystem/input_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' \
Expand Down
30 changes: 30 additions & 0 deletions tests/dynamic_data/publications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 1e4e9ac

Please sign in to comment.