Skip to content

Commit

Permalink
update other mocked test
Browse files Browse the repository at this point in the history
  • Loading branch information
GiaJordan committed Nov 20, 2024
1 parent 800a4cd commit 95cfeed
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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
)
Expand Down

0 comments on commit 95cfeed

Please sign in to comment.