Skip to content

Commit

Permalink
[Fixes #12368] fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed Oct 15, 2024
1 parent 5d4f7a0 commit d35699e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions geonode/upload/handlers/common/tests_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/handlers/csv/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/handlers/geojson/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/handlers/shapefile/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions geonode/upload/tests/end2end/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand All @@ -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
)
Expand Down Expand Up @@ -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")

Expand Down
2 changes: 0 additions & 2 deletions geonode/upload/tests/unit/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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",
},
Expand Down

0 comments on commit d35699e

Please sign in to comment.