diff --git a/tests/unit_tests/test_geoserver_engine.py b/tests/unit_tests/test_geoserver_engine.py index 329968f..13a0923 100644 --- a/tests/unit_tests/test_geoserver_engine.py +++ b/tests/unit_tests/test_geoserver_engine.py @@ -2285,7 +2285,6 @@ def test_create_shapefile_resource(self, mock_catalog, mock_put): mc.get_default_workspace.assert_called_with() mc.get_resource.assert_called_with( - name=self.store_names[0], store=self.store_names[0], workspace=self.workspace_name[0], ) @@ -2321,7 +2320,7 @@ def test_create_shapefile_resource_zipfile(self, mock_catalog, mock_put): self.assertIn(self.store_name[0], r["store"]) mc.get_resource.assert_called_with( - name="test1", store=self.store_names[0], workspace=self.workspace_name + store=self.store_names[0], workspace=self.workspace_name ) @mock.patch("tethys_dataset_services.engines.geoserver_engine.requests.put") @@ -2364,7 +2363,6 @@ def test_create_shapefile_resource_upload(self, mock_catalog, mock_put): self.assertIn(self.store_name[0], r["store"]) mc.get_resource.assert_called_with( - name=self.store_names[0], store=self.store_names[0], workspace=self.workspace_name, ) @@ -2440,7 +2438,6 @@ def test_create_shapefile_resource_overwrite_store_not_exists( self.assertIn(self.store_name[0], r["store"]) mc.get_resource.assert_called_with( - name=self.store_names[0], store=self.store_names[0], workspace=self.workspace_name, ) diff --git a/tethys_dataset_services/engines/geoserver_engine.py b/tethys_dataset_services/engines/geoserver_engine.py index 9cc3a83..395cb83 100644 --- a/tethys_dataset_services/engines/geoserver_engine.py +++ b/tethys_dataset_services/engines/geoserver_engine.py @@ -1963,7 +1963,6 @@ def create_sql_view_layer( template = Template(text) xml = template.render(context) - # Decide method, aligned with current GWC REST: # PUT => add new layer, POST => modify existing layer method = (gwc_method or "AUTO").upper() @@ -2219,19 +2218,9 @@ def create_shapefile_resource(self, store_id, shapefile_base=None, shapefile_zip self._handle_debug(response_dict, debug) return response_dict - if shapefile_base: - # This case uses the store name as the Resource ID. - resource_id = name - elif shapefile_zip: - # This case uses the filename as the Resource ID. - resource_id = os.path.splitext(os.path.basename(shapefile_zip))[0] - elif shapefile_upload: - # This case uses the store name as the Resource ID. - resource_id = name - # Set the default style if default_style is not None: - layer_url = self._assemble_url('layers', f'{workspace}:{resource_id}.xml') + layer_url = self._assemble_url("layers", name) layer_headers = {"Content-Type": "application/xml"} layer_data = f""" @@ -2259,7 +2248,7 @@ def create_shapefile_resource(self, store_id, shapefile_base=None, shapefile_zip # Wrap up successfully new_resource = self.catalog.get_resource( - name=resource_id, store=name, workspace=workspace + store=name, workspace=workspace ) resource_dict = self._transcribe_geoserver_object(new_resource) @@ -3040,8 +3029,7 @@ def delete_layer_group(self, layer_group_id): if not workspace: workspace = self.catalog.get_default_workspace().name - url = self._assemble_url("workspaces", workspace, "layergroups", - f"{group_name}") + url = self._assemble_url("workspaces", workspace, "layergroups", f"{group_name}") response = requests.delete( url, auth=(self.username, self.password),