Skip to content

Commit

Permalink
Ensure index on extensions found multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
ridoo committed Oct 16, 2023
1 parent 37be03a commit b75d185
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion geonode/storage/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,22 @@ def test_zip_file_should_correctly_recognize_main_extension_with_csv(self):

self.assertIsNotNone(storage_manager.data_retriever.temporary_folder)
_files = storage_manager.get_retrieved_paths()
self.assertTrue("example.csv" in _files.get("base_file"))
# Selected base_file is not defined in case of multiple csv files
self.assertTrue(_files.get("base_file").endswith(".csv"))

def test_zip_file_should_correctly_index_file_extensions(self):
# reinitiate the storage manager with the zip file
storage_manager = self.sut(
remote_files={"base_file": os.path.join(f"{self.project_root}", "tests/data/example.zip")}
)
storage_manager.clone_remote_files()

self.assertIsNotNone(storage_manager.data_retriever.temporary_folder)
_files = storage_manager.get_retrieved_paths()
# Selected base_file is not defined in case of multiple csv files
self.assertIsNotNone(_files.get("csv_file"))
# extensions found more than once get indexed
self.assertIsNotNone(_files.get("csv_file_1"))

@override_settings(
SUPPORTED_DATASET_FILE_TYPES=[
Expand Down
Binary file modified geonode/storage/tests/data/example.zip
Binary file not shown.

0 comments on commit b75d185

Please sign in to comment.