@@ -231,19 +231,19 @@ async def test_provenance_recorded_from_manifest(
231231 )
232232
233233 # WHEN I sync to Synapse
234- await project_model .sync_to_synapse_async (
234+ uploaded_files = await project_model .sync_to_synapse_async (
235235 manifest_path = str (manifest_path ),
236236 send_messages = False ,
237237 synapse_client = self .syn ,
238238 )
239239
240- # THEN the file has activity with the expected provenance
241- synced = await Project ( id = project_model .id ). sync_from_synapse_async (
242- recursive = False , download_file = False , synapse_client = self . syn
243- )
244- uploaded = next (( f for f in synced . files if f . name == unique_name ), None )
245- assert uploaded is not None
246- self . schedule_for_cleanup ( uploaded .id )
240+ for f in uploaded_files :
241+ self . schedule_for_cleanup ( f .id )
242+
243+ # THEN the file is returned with the expected provenance
244+ assert len ( uploaded_files ) == 1
245+ uploaded = uploaded_files [ 0 ]
246+ assert uploaded .name == unique_name
247247
248248 refreshed = await File (id = uploaded .id ).get_async (
249249 include_activity = True , synapse_client = self .syn
@@ -274,19 +274,15 @@ async def test_dry_run_does_not_upload(
274274 )
275275
276276 # WHEN I sync with dry_run=True
277- await project_model .sync_to_synapse_async (
277+ uploaded_files = await project_model .sync_to_synapse_async (
278278 manifest_path = str (manifest_path ),
279279 dry_run = True ,
280280 send_messages = False ,
281281 synapse_client = self .syn ,
282282 )
283283
284- # THEN no file with that name should exist in the project
285- synced = await Project (id = project_model .id ).sync_from_synapse_async (
286- recursive = False , download_file = False , synapse_client = self .syn
287- )
288- names = {f .name for f in synced .files }
289- assert unique_name not in names
284+ # THEN no files were uploaded
285+ assert uploaded_files == []
290286
291287 async def test_upload_into_subfolder (
292288 self , project_model : Project , tmp_path : Path
@@ -312,20 +308,23 @@ async def test_upload_into_subfolder(
312308 )
313309
314310 # WHEN I sync to Synapse
315- await project_model .sync_to_synapse_async (
311+ uploaded_files = await project_model .sync_to_synapse_async (
316312 manifest_path = str (manifest_path ),
317313 send_messages = False ,
318314 synapse_client = self .syn ,
319315 )
320316
317+ for f in uploaded_files :
318+ self .schedule_for_cleanup (f .id )
319+
321320 # THEN the file exists inside the folder, not at the project root
322- synced_folder = await Folder (id = folder .id ).sync_from_synapse_async (
323- recursive = False , download_file = False , synapse_client = self .syn
321+ assert len (uploaded_files ) == 1
322+ assert uploaded_files [0 ].name == "in_folder.txt"
323+
324+ file_entity = await File (id = uploaded_files [0 ].id ).get_async (
325+ synapse_client = self .syn
324326 )
325- names = {f .name for f in synced_folder .files }
326- assert "in_folder.txt" in names
327- for f in synced_folder .files :
328- self .schedule_for_cleanup (f .id )
327+ assert file_entity .parent_id == folder .id
329328
330329 async def test_non_container_parent_id_raises (
331330 self , project_model : Project , tmp_path : Path
@@ -385,20 +384,15 @@ async def test_error_column_rows_skipped(
385384 )
386385
387386 # WHEN I sync to Synapse
388- await project_model .sync_to_synapse_async (
387+ uploaded_files = await project_model .sync_to_synapse_async (
389388 manifest_path = str (manifest_path ),
390389 send_messages = False ,
391390 synapse_client = self .syn ,
392391 )
393392
394- # THEN only the valid row was uploaded
395- synced = await Project (id = project_model .id ).sync_from_synapse_async (
396- recursive = False , download_file = False , synapse_client = self .syn
397- )
398- names = {f .name for f in synced .files }
399- assert unique_name in names
400- assert "should_not_appear.txt" not in names
393+ for f in uploaded_files :
394+ self .schedule_for_cleanup (f .id )
401395
402- for f in synced . files :
403- if f . name == unique_name :
404- self . schedule_for_cleanup ( f . id )
396+ # THEN only the valid row was uploaded
397+ assert len ( uploaded_files ) == 1
398+ assert uploaded_files [ 0 ]. name == unique_name
0 commit comments