Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
GiaJordan committed Aug 16, 2024
1 parent dc7fac4 commit 2ecb5d6
Showing 1 changed file with 44 additions and 12 deletions.
56 changes: 44 additions & 12 deletions tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,27 +432,59 @@ def test_getDatasetManifest(self, synapse_store, downloadFile):
assert manifest_data == "syn51204513"

@pytest.mark.parametrize(
"existing_manifest_df",
"existing_manifest_df,fill_in",
[
pd.DataFrame(),
pd.DataFrame(
{
"Filename": ["existing_mock_file_path"],
"entityId": ["existing_mock_entity_id"],
}
(
pd.DataFrame(),
[
{
"Filename": ["mock_file_path"],
"entityId": ["mock_entity_id"],
},
{
"Filename": ["mock_file_path"],
"entityId": ["mock_entity_id"],
},
],
),
(
pd.DataFrame(
{
"Filename": ["existing_mock_file_path"],
"entityId": ["existing_mock_entity_id"],
}
),
[
{
"Filename": ["existing_mock_file_path", "mock_file_path"],
"entityId": ["existing_mock_entity_id", "mock_entity_id"],
},
{
"Filename": ["mock_file_path"],
"entityId": ["mock_entity_id"],
},
],
),
],
)
def test_fill_in_entity_id_filename(self, synapse_store, existing_manifest_df):
def test_fill_in_entity_id_filename(
self, synapse_store, existing_manifest_df, fill_in
):
fill_in_first_return_value = {
"Filename": ["mock_file_path"],
"entityId": ["mock_entity_id"],
}
fill_in_first_return_value = {
"Filename": ["existing_mock_file_path", "mock_file_path"],
"entityId": ["existing_mock_entity_id", "mock_entity_id"],
}

with patch(
"schematic.store.synapse.SynapseStorage.getFilesInStorageDataset",
return_value=["syn123", "syn124", "syn125"],
) as mock_get_file_storage, patch(
"schematic.store.synapse.SynapseStorage._get_file_entityIds",
return_value={
"Filename": ["mock_file_path"],
"entityId": ["mock_entity_id"],
},
side_effect=fill_in,
) as mock_get_file_entity_id:
dataset_files, new_manifest = synapse_store.fill_in_entity_id_filename(
datasetId="test_syn_id", manifest=existing_manifest_df
Expand Down

0 comments on commit 2ecb5d6

Please sign in to comment.