diff --git a/test_tools/process_client.py b/test_tools/process_client.py index 1a06af67f..f3b0761d6 100644 --- a/test_tools/process_client.py +++ b/test_tools/process_client.py @@ -46,6 +46,7 @@ 'patch_workspace_publication_url', 'get_workspace_publications_url', 'get_workspace_publication_url', + 'get_workspace_publication_thumbnail_url', 'delete_workspace_publication_url', 'delete_workspace_publications_url', 'keys_to_check', @@ -59,6 +60,7 @@ 'rest_workspace_map.patch', 'rest_workspace_maps.get', 'rest_workspace_map.get', + 'rest_workspace_map_thumbnail.get', 'rest_workspace_map.delete_map', 'rest_workspace_maps.delete', map_keys_to_check, @@ -72,6 +74,7 @@ 'rest_workspace_layer.patch', 'rest_workspace_layers.get', 'rest_workspace_layer.get', + 'rest_workspace_layer_thumbnail.get', 'rest_workspace_layer.delete_layer', 'rest_workspace_layers.delete', layer_keys_to_check, @@ -91,6 +94,7 @@ None, None, None, + None, ), } @@ -738,3 +742,19 @@ def get_workspace_map_file(publication_type, workspace, name, headers=None, acto response = requests.get(r_url, headers=headers, timeout=HTTP_TIMEOUT) raise_layman_error(response) return response.json() + + +def get_workspace_publication_thumbnail(publication_type, workspace, name, *, actor_name=None): + headers = {} + publication_type_def = PUBLICATION_TYPES_DEF[publication_type] + if actor_name: + assert TOKEN_HEADER not in headers + + if actor_name and actor_name != settings.ANONYM_USER: + headers.update(get_authz_headers(actor_name)) + + with app.app_context(): + r_url = url_for(publication_type_def.get_workspace_publication_thumbnail_url, **{publication_type_def.url_param_name: name}, workspace=workspace) + response = requests.get(r_url, headers=headers, timeout=HTTP_TIMEOUT) + raise_layman_error(response) + return response.content