Skip to content

Commit

Permalink
Test map thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Sep 26, 2023
1 parent d162a98 commit 842f847
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'exp_before_rest_method': {
'map_layers': None,
'operates_on': None,
'thumbnail': None,
},
'rest_method': base_test_classes.RestMethodAll.POST,
'rest_args': {
Expand All @@ -43,6 +44,7 @@
(LAYER_HRANICE, 3, True),
},
'operates_on': [LAYER_HRANICE],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_hranice_thumbnail.png'),
},
},
'delete': {
Expand All @@ -56,12 +58,14 @@
(LAYER_HRANICE, 3, True),
},
'operates_on': [LAYER_HRANICE],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_hranice_thumbnail.png'),
},
'rest_method': base_test_classes.RestMethodAll.DELETE,
'rest_args': {},
'exp_after_rest_method': {
'map_layers': None,
'operates_on': None,
'thumbnail': None,
},
},
'patch_map_with_unauthorized_layer': {
Expand All @@ -71,14 +75,17 @@
'exp_before_rest_method': {
'map_layers': [(LAYER_HRANICE_PRIVATE, 1, True)],
'operates_on': [],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_thumbnail.png'),
},
'rest_method': base_test_classes.RestMethodAll.PATCH,
'rest_args': {
'file_paths': [os.path.join(DIRECTORY, 'internal_hranice_private.json')],
'actor_name': PRIVATE_WORKSPACE,
},
'exp_after_rest_method': {
'map_layers': [(LAYER_HRANICE_PRIVATE, 1, True)],
'operates_on': [LAYER_HRANICE_PRIVATE],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_hranice_thumbnail.png'),
},
},
'patch_map_with_different_layers': {
Expand All @@ -93,6 +100,7 @@
(LAYER_HRANICE, 3, True),
},
'operates_on': [LAYER_HRANICE],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_hranice_thumbnail.png'),
},
'rest_method': base_test_classes.RestMethodAll.PATCH,
'rest_args': {
Expand All @@ -102,6 +110,7 @@
'exp_after_rest_method': {
'map_layers': [(LAYER_HRANICE_PRIVATE, 1, True)],
'operates_on': [LAYER_HRANICE_PRIVATE],
'thumbnail': os.path.join(DIRECTORY, 'map_liberec_hranice_thumbnail.png'),
},
},
}
Expand Down Expand Up @@ -195,6 +204,12 @@ def assert_exp_layer_maps(layer, map_operates_on_tuples):
]
assert found_layer_maps == exp_layer_maps

@staticmethod
def assert_exp_map_thumbnail(map, exp_thumbnail):
if exp_thumbnail:
asserts_publ.internal.thumbnail_equals(map.workspace, map.type, map.name, exp_thumbnail,
max_diffs=0)

def test_publication(self, map, rest_method, rest_args, params):
exp = params['exp_before_rest_method']
self.assert_exp_map_layers(map, exp['map_layers'], exp['operates_on'], http_method=REQUEST_METHOD_POST,
Expand All @@ -203,6 +218,7 @@ def test_publication(self, map, rest_method, rest_args, params):
(MAP_HRANICE, MAP_HRANICE_OPERATES_ON),
(map, exp['operates_on'] or []),
])
self.assert_exp_map_thumbnail(map, exp['thumbnail'])

rest_method.fn(map, args=rest_args)
if rest_method.enum_item in [base_test_classes.RestMethodAll.POST, base_test_classes.RestMethodAll.PATCH]:
Expand All @@ -217,3 +233,4 @@ def test_publication(self, map, rest_method, rest_args, params):
(MAP_HRANICE, MAP_HRANICE_OPERATES_ON),
(map, exp['operates_on'] or []),
])
self.assert_exp_map_thumbnail(map, exp['thumbnail'])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 842f847

Please sign in to comment.