diff --git a/importer/handlers/common/tests_vector.py b/importer/handlers/common/tests_vector.py index 6ecc786d..fab03353 100644 --- a/importer/handlers/common/tests_vector.py +++ b/importer/handlers/common/tests_vector.py @@ -226,7 +226,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command( _open.assert_called_once() _open.assert_called_with( - f'/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:" dbname=\'test_geonode_data\' host={host=' + {os.getenv('DATABASE_HOST', 'localhost')} + '} port=5432 user=\'geonode_data\' password=\'geonode_data\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset"', + f'/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\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset"', stdout=-1, stderr=-1, shell=True, # noqa @@ -252,7 +252,7 @@ def test_import_with_ogr2ogr_with_errors_should_raise_exception(self, _open): _open.assert_called_once() _open.assert_called_with( - f'/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:" dbname=\'test_geonode_data\' host={host=' + {os.getenv('DATABASE_HOST', 'localhost')} + '} port=5432 user=\'geonode_data\' password=\'geonode_data\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset"', + f'/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\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset"', stdout=-1, stderr=-1, shell=True, # noqa diff --git a/importer/handlers/csv/tests.py b/importer/handlers/csv/tests.py index 7f9bdad5..0a7281d1 100644 --- a/importer/handlers/csv/tests.py +++ b/importer/handlers/csv/tests.py @@ -1,6 +1,6 @@ import uuid from unittest.mock import MagicMock, patch - +import os from django.contrib.auth import get_user_model from django.test import TestCase from geonode.base.populate_test_data import create_single_dataset @@ -165,7 +165,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command( _open.assert_called_once() _open.assert_called_with( - f'/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:" dbname=\'test_geonode_data\' host={host=' + {os.getenv('DATABASE_HOST', 'localhost')} + '} port=5432 user=\'geonode_data\' password=\'geonode_data\' " "{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*"', + f'/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\' " "{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*"', stdout=-1, stderr=-1, shell=True, # noqa diff --git a/importer/handlers/geojson/tests.py b/importer/handlers/geojson/tests.py index e0660064..0836f13b 100644 --- a/importer/handlers/geojson/tests.py +++ b/importer/handlers/geojson/tests.py @@ -1,4 +1,5 @@ import uuid +import os from django.test import TestCase from mock import MagicMock, patch from importer.handlers.common.vector import import_with_ogr2ogr @@ -130,7 +131,7 @@ def test_import_with_ogr2ogr_without_errors_should_call_the_right_command( _open.assert_called_once() _open.assert_called_with( - f'/usr/bin/ogr2ogr --config PG_USE_COPY YES -f PostgreSQL PG:" dbname=\'test_geonode_data\' host={host=' + {os.getenv('DATABASE_HOST', 'localhost')} + '} port=5432 user=\'geonode_data\' password=\'geonode_data\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset" -lco GEOMETRY_NAME=geometry', + f'/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\' " "{self.valid_files.get("base_file")}" -nln alternate "dataset" -lco GEOMETRY_NAME=geometry', stdout=-1, stderr=-1, shell=True, # noqa diff --git a/runtest.sh b/runtest.sh index 6928ee20..bb8b89d2 100755 --- a/runtest.sh +++ b/runtest.sh @@ -2,4 +2,4 @@ set -a . ./.env_test set +a -coverage run --append --source='.' /usr/src/geonode/manage.py test importer --keepdb -v2 --noinput \ No newline at end of file +coverage run --append --source='.' /usr/src/geonode/manage.py test importer -v2 --noinput \ No newline at end of file