From 95cfeed84e81ae74696fa65a32df8503c28dbc82 Mon Sep 17 00:00:00 2001 From: GiaJordan Date: Wed, 20 Nov 2024 14:54:47 -0700 Subject: [PATCH] update other mocked test --- tests/test_store.py | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/tests/test_store.py b/tests/test_store.py index 9aa0b87a3..65bc5c59c 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -475,22 +475,14 @@ def test_getDatasetProject(self, dataset_id, synapse_store): ], ) def test_getFilesInStorageDataset(self, synapse_store, full_path, expected): - mock_return = [ - ( - ("parent_folder", "syn123"), - [("test_folder", "syn124")], - [], - ), - ( - ( - os.path.join("schematic - main", "parent_folder", "test_folder"), - "syn124", - ), - [], - [], - ), - ] - mock_table_dataFrame = pd.DataFrame( + mock_table_dataFrame_initial = pd.DataFrame( + { + "id": ["syn_mock"], + "path": ["schematic - main/parent_folder"], + } + ) + + mock_table_dataFrame_return = pd.DataFrame( { "id": ["syn126", "syn125"], "path": [ @@ -499,13 +491,18 @@ def test_getFilesInStorageDataset(self, synapse_store, full_path, expected): ], } ) - mock_table = build_table("Mock Table", "syn123", mock_table_dataFrame) + mock_table_return = build_table( + "Mock Table", "syn123", mock_table_dataFrame_return + ) - with patch( - "synapseutils.walk_functions._help_walk", return_value=mock_return - ) as mock_walk_patch: - with patch.object(synapse_store, "syn") as mocked_synapse_client: - mocked_synapse_client.tableQuery.return_value = mock_table + with patch.object(synapse_store, "syn") as mocked_synapse_client: + with patch.object( + synapse_store, "storageFileviewTable" + ) as mocked_fileview_table: + mocked_fileview_table.storageFileviewTable.return_value = ( + mock_table_dataFrame_initial + ) + mocked_synapse_client.tableQuery.return_value = mock_table_return file_list = synapse_store.getFilesInStorageDataset( datasetId="syn_mock", fileNames=None, fullpath=full_path )