File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
geonode/upload/handlers/common Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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
537553class TestUpsertBaseVectorHandler (TransactionImporterBaseTestSupport ):
538554 """
You can’t perform that action at this time.
0 commit comments