diff --git a/g3w-admin/qdjango/tests/data/geodata/qgis_widget_test_data.gpkg b/g3w-admin/qdjango/tests/data/geodata/qgis_widget_test_data.gpkg index cd391090a..0e3514bb1 100644 Binary files a/g3w-admin/qdjango/tests/data/geodata/qgis_widget_test_data.gpkg and b/g3w-admin/qdjango/tests/data/geodata/qgis_widget_test_data.gpkg differ diff --git a/g3w-admin/qdjango/tests/test_api.py b/g3w-admin/qdjango/tests/test_api.py index 9d91f9037..c35d1341e 100644 --- a/g3w-admin/qdjango/tests/test_api.py +++ b/g3w-admin/qdjango/tests/test_api.py @@ -1166,6 +1166,7 @@ def test_tokenfilter_mode_api(self): 'state': 'created' }) + # Filter for layer cities: DELETE resp = json.loads(self._testApiCall('core-vector-api', ['filtertoken', 'qdjango', self.project310.instance.pk, @@ -1207,6 +1208,48 @@ def test_tokenfilter_mode_api(self): self.assertFalse(token == sf.token) self.assertEqual(sf.stf_layers.all()[0].qgs_expr, '$id NOT IN (6,8,9,0)') + # Filter for layer check /api/config REST API: + resp = json.loads(self._testApiCall('group-project-map-config', + [ + self.project310.instance.group.slug, + 'qdjango', + self.project310.instance.pk], logout=False).content + ) + + for l in resp['layers']: + if l['id'] == cities.qgs_layer_id: + self.assertTrue('filters' in l) + self.assertEqual(len(l['filters']), 1) + else: + self.assertFalse('filters' in l) + + # Filter for layer cities: DELETE + resp = json.loads(self._testApiCall('core-vector-api', + ['filtertoken', 'qdjango', self.project310.instance.pk, + cities.qgs_layer_id], + { + 'mode': 'delete_saved', + 'fid': '1' + }, logout=False).content) + + # Check the db + fls = FilterLayerSaved.objects.filter(layer=cities) + self.assertEqual(len(fls), 0) + + resp = json.loads(self._testApiCall('group-project-map-config', + [ + self.project310.instance.group.slug, + 'qdjango', + self.project310.instance.pk], logout=False).content + ) + + for l in resp['layers']: + if l['id'] == cities.qgs_layer_id: + self.assertFalse('filters' in l) + else: + self.assertFalse('filters' in l) + + def test_download_vector_api_selected_wms_fields(self):