From d35699ea0b4abc490ca3f741d3b1163c5e04b506 Mon Sep 17 00:00:00 2001 From: Mattia Date: Tue, 15 Oct 2024 13:30:24 +0200 Subject: [PATCH] [Fixes #12368] fix build --- geonode/upload/handlers/common/tests_vector.py | 4 ++-- geonode/upload/handlers/csv/tests.py | 2 +- geonode/upload/handlers/geojson/tests.py | 2 +- geonode/upload/handlers/shapefile/tests.py | 2 +- geonode/upload/tests/end2end/test_end2end.py | 6 ++++++ geonode/upload/tests/unit/test_task.py | 2 -- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/geonode/upload/handlers/common/tests_vector.py b/geonode/upload/handlers/common/tests_vector.py index 20e7d3dbc00..9564935eecd 100644 --- a/geonode/upload/handlers/common/tests_vector.py +++ b/geonode/upload/handlers/common/tests_vector.py @@ -242,7 +242,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command(self, _open.assert_called_with( "/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:\" dbname='test_geonode_data' host=" + os.getenv("DATABASE_HOST", "localhost") - + " port=5432 user='geonode_data' password='geonode_data' \" \"" + + " port=5432 user='geonode_data' password='geonode' \" \"" + self.valid_files.get("base_file") + '" -nln alternate "dataset"', stdout=-1, @@ -272,7 +272,7 @@ def test_import_with_ogr2ogr_with_errors_should_raise_exception(self, _open): _open.assert_called_with( "/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:\" dbname='test_geonode_data' host=" + os.getenv("DATABASE_HOST", "localhost") - + " port=5432 user='geonode_data' password='geonode_data' \" \"" + + " port=5432 user='geonode_data' password='geonode' \" \"" + self.valid_files.get("base_file") + '" -nln alternate "dataset"', stdout=-1, diff --git a/geonode/upload/handlers/csv/tests.py b/geonode/upload/handlers/csv/tests.py index f464c36fe50..21ad69f6b41 100644 --- a/geonode/upload/handlers/csv/tests.py +++ b/geonode/upload/handlers/csv/tests.py @@ -167,7 +167,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command(self, _open.assert_called_with( "/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:\" dbname='test_geonode_data' host=" + os.getenv("DATABASE_HOST", "localhost") - + " port=5432 user='geonode_data' password='geonode_data' \" \"" + + " port=5432 user='geonode_data' password='geonode' \" \"" + self.valid_csv + '" -nln alternate "dataset" -oo KEEP_GEOM_COLUMNS=NO -lco GEOMETRY_NAME=geometry -oo "GEOM_POSSIBLE_NAMES=geom*,the_geom*,wkt_geom" -oo "X_POSSIBLE_NAMES=x,long*" -oo "Y_POSSIBLE_NAMES=y,lat*"', # noqa stdout=-1, diff --git a/geonode/upload/handlers/geojson/tests.py b/geonode/upload/handlers/geojson/tests.py index eb6af003e93..4b56f0a98b3 100644 --- a/geonode/upload/handlers/geojson/tests.py +++ b/geonode/upload/handlers/geojson/tests.py @@ -136,7 +136,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command(self, _open.assert_called_with( "/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:\" dbname='test_geonode_data' host=" + os.getenv("DATABASE_HOST", "localhost") - + " port=5432 user='geonode_data' password='geonode_data' \" \"" + + " port=5432 user='geonode_data' password='geonode' \" \"" + self.valid_files.get("base_file") + '" -nln alternate "dataset" -lco GEOMETRY_NAME=geometry', stdout=-1, diff --git a/geonode/upload/handlers/shapefile/tests.py b/geonode/upload/handlers/shapefile/tests.py index eeb5f0ff36a..560b42ed2bc 100644 --- a/geonode/upload/handlers/shapefile/tests.py +++ b/geonode/upload/handlers/shapefile/tests.py @@ -163,7 +163,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command(self, _open.assert_called_with( "/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:\" dbname='test_geonode_data' host=" + os.getenv("DATABASE_HOST", "localhost") - + " port=5432 user='geonode_data' password='geonode_data' \" \"" + + " port=5432 user='geonode_data' password='geonode' \" \"" + self.valid_shp.get("base_file") + '" -nln alternate "dataset" -lco precision=no -lco GEOMETRY_NAME=geometry ', stdout=-1, diff --git a/geonode/upload/tests/end2end/test_end2end.py b/geonode/upload/tests/end2end/test_end2end.py index 902f46fb0a1..a2ad76cfd9a 100644 --- a/geonode/upload/tests/end2end/test_end2end.py +++ b/geonode/upload/tests/end2end/test_end2end.py @@ -195,6 +195,7 @@ def test_import_gpkg_overwrite(self): } initial_name = "stazioni_metropolitana" payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport(payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated) self._cleanup_layers(name="stazioni_metropolitana") @@ -277,6 +278,7 @@ def test_import_geojson_overwrite(self): } initial_name = "valid" payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport(payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated) self._cleanup_layers(name="valid") @@ -306,6 +308,7 @@ def test_import_csv_overwrite(self): } initial_name = "valid" payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport(payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated) self._cleanup_layers(name="valid") @@ -334,6 +337,7 @@ def test_import_kml_overwrite(self): } initial_name = "sample_point_dataset" payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport(payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated) self._cleanup_layers(name="sample_point_dataset") @@ -358,6 +362,7 @@ def test_import_shapefile_overwrite(self): prev_dataset = self._assertimport(payload, initial_name, keep_resource=True) payload = {_filename: open(_file, "rb") for _filename, _file in self.valid_shp.items()} payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport( payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated, keep_resource=True ) @@ -388,6 +393,7 @@ def test_import_raster_overwrite(self): } initial_name = "test_raster" payload["overwrite_existing_layer"] = True + payload["resource_pk"] = prev_dataset.pk self._assertimport(payload, initial_name, overwrite=True, last_update=prev_dataset.last_updated) self._cleanup_layers(name="test_raster") diff --git a/geonode/upload/tests/unit/test_task.py b/geonode/upload/tests/unit/test_task.py index 7945cdb9ff5..5d6b626c24e 100644 --- a/geonode/upload/tests/unit/test_task.py +++ b/geonode/upload/tests/unit/test_task.py @@ -404,7 +404,6 @@ def test_rollback_works_as_expected_vector_step( action="import", input_params={ "files": {"base_file": self.existing_file}, - "overwrite_existing_layer": True, "store_spatial_files": True, "handler_module_path": "geonode.upload.handlers.gpkg.handler.GPKGFileHandler", }, @@ -460,7 +459,6 @@ def test_rollback_works_as_expected_raster( action="import", input_params={ "files": {"base_file": "/tmp/filepath"}, - "overwrite_existing_layer": True, "store_spatial_files": True, "handler_module_path": "geonode.upload.handlers.geotiff.handler.GeoTiffFileHandler", },