File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ def _unzip(self, zip_name: str) -> Mapping:
202
202
the_zip = zipfile .ZipFile (zip_file , allowZip64 = True )
203
203
the_zip .extractall (self .temporary_folder )
204
204
available_choices = get_allowed_extensions ()
205
- not_main_files = ['xml' , 'sld' , 'zip' ]
205
+ not_main_files = ['xml' , 'sld' , 'zip' , 'kmz' ]
206
206
base_file_choices = [x for x in available_choices if x not in not_main_files ]
207
207
for _file in Path (self .temporary_folder ).iterdir ():
208
208
if any ([_file .name .endswith (_ext ) for _ext in base_file_choices ]):
Original file line number Diff line number Diff line change 19
19
import io
20
20
import os
21
21
import shutil
22
+ from django .test import override_settings
22
23
import gisdata
23
24
from unittest .mock import patch
24
25
@@ -584,6 +585,26 @@ def test_zip_file_should_correctly_recognize_main_extension_with_csv(self):
584
585
_files = storage_manager .get_retrieved_paths ()
585
586
self .assertTrue ("example.csv" in _files .get ("base_file" ))
586
587
588
+ @override_settings (SUPPORTED_DATASET_FILE_TYPES = [{
589
+ "id" : "kmz" ,
590
+ "label" : "kmz" ,
591
+ "format" : "vector" ,
592
+ "ext" : ["kmz" ]
593
+ }, {
594
+ "id" : "kml" ,
595
+ "label" : "kml" ,
596
+ "format" : "vector" ,
597
+ "ext" : ["kml" ]
598
+ }])
599
+ def test_zip_file_should_correctly_recognize_main_extension_with_kmz (self ):
600
+ # reinitiate the storage manager with the zip file
601
+ storage_manager = self .sut (remote_files = {"base_file" : os .path .join (f"{ self .project_root } " , "tests/data/Italy.kmz" )})
602
+ storage_manager .clone_remote_files ()
603
+
604
+ self .assertIsNotNone (storage_manager .data_retriever .temporary_folder )
605
+ _files = storage_manager .get_retrieved_paths ()
606
+ self .assertTrue ("doc.kml" in _files .get ("base_file" ), msg = f"files available: { _files } " )
607
+
587
608
def test_zip_file_should_correctly_recognize_main_extension_with_shp (self ):
588
609
# zipping files
589
610
storage_manager = self .sut (remote_files = self .local_files_paths )
You can’t perform that action at this time.
0 commit comments