Skip to content

Commit 3609397

Browse files
committed
[Fixes #13617] added test case for copy table with ogr2ogr
1 parent 69a6087 commit 3609397

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

geonode/upload/handlers/common/tests_vector.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,22 @@ def test_get_error_file_csv_headers(self):
533533
headers = handler._BaseVectorFileHandler__get_csv_headers()
534534
self.assertEqual(headers, ["fid", "type", "error"])
535535

536+
@patch("geonode.upload.handlers.common.vector.Popen")
537+
def test_copy_table_with_ogr2ogr(self, mock_popen):
538+
comm = MagicMock()
539+
comm.communicate.return_value = b"", b""
540+
mock_popen.return_value = comm
541+
542+
BaseVectorFileHandler.copy_table_with_ogr2ogr("original_table", "new_table", "datastore")
543+
544+
mock_popen.assert_called_once()
545+
call_args = mock_popen.call_args[0][0]
546+
547+
self.assertIn("ogr2ogr", call_args[0])
548+
self.assertIn("-nln", call_args)
549+
self.assertIn("new_table", call_args)
550+
self.assertIn("original_table", call_args)
551+
536552

537553
class TestUpsertBaseVectorHandler(TransactionImporterBaseTestSupport):
538554
"""

0 commit comments

Comments
 (0)