diff --git a/tests/integration_tests/python/test_uploads.py b/tests/integration_tests/python/test_uploads.py index 9da192c33..2ac64f6c8 100644 --- a/tests/integration_tests/python/test_uploads.py +++ b/tests/integration_tests/python/test_uploads.py @@ -777,6 +777,11 @@ def test_session_engine_upload(data_builder, file_form, as_root): 'name': 'two.csv', 'type': 'engine type 1', 'info': {'test': 'f1'} + }, + { + 'name': 'folder:three.csv', + 'type': 'engine type 2', + 'info': {'test': 'f2'} } ] } @@ -784,7 +789,7 @@ def test_session_engine_upload(data_builder, file_form, as_root): r = as_root.post('/engine', params={'level': 'session', 'id': session}, - files=file_form('one.csv', 'two.csv', meta=metadata) + files=file_form('one.csv', 'two.csv', 'folder:three.csv', meta=metadata) ) assert r.ok @@ -807,7 +812,11 @@ def test_session_engine_upload(data_builder, file_form, as_root): assert s_timestamp == m_timestamp for f in s['files']: - mf = find_file_in_array(f['name'], metadata['session']['files']) + if '/' in f['name']: + assert f['name'] == 'folder/three.csv' + mf = find_file_in_array(f['name'].replace('/', ':'), metadata['session']['files']) + else: + mf = find_file_in_array(f['name'], metadata['session']['files']) assert mf is not None assert f['type'] == mf['type'] assert f['info'] == mf['info'] @@ -829,6 +838,11 @@ def test_project_engine_upload(data_builder, file_form, as_root): 'name': 'two.csv', 'type': 'engine type 1', 'info': {'test': 'f1'} + }, + { + 'name': 'folder:three.csv', + 'type': 'engine type 2', + 'info': {'test': 'f2'} } ] } @@ -836,7 +850,7 @@ def test_project_engine_upload(data_builder, file_form, as_root): r = as_root.post('/engine', params={'level': 'project', 'id': project}, - files=file_form('one.csv', 'two.csv', meta=metadata) + files=file_form('one.csv', 'two.csv', 'folder:three.csv', meta=metadata) ) assert r.ok @@ -848,7 +862,11 @@ def test_project_engine_upload(data_builder, file_form, as_root): assert p['info'] == metadata['project']['info'] for f in p['files']: - mf = find_file_in_array(f['name'], metadata['project']['files']) + if '/' in f['name']: + assert f['name'] == 'folder/three.csv' + mf = find_file_in_array(f['name'].replace('/', ':'), metadata['project']['files']) + else: + mf = find_file_in_array(f['name'], metadata['project']['files']) assert mf is not None assert f['type'] == mf['type'] assert f['info'] == mf['info'] @@ -856,7 +874,8 @@ def test_project_engine_upload(data_builder, file_form, as_root): def test_acquisition_file_only_engine_upload(data_builder, file_form, as_root): acquisition = data_builder.create_acquisition() - file_names = ['one.csv', 'two.csv'] + file_names = ['one.csv', 'folder:two.csv'] + expected_file_names = ['one.csv', 'folder/two.csv'] r = as_root.post('/engine', params={'level': 'acquisition', 'id': acquisition}, @@ -866,7 +885,7 @@ def test_acquisition_file_only_engine_upload(data_builder, file_form, as_root): r = as_root.get('/acquisitions/' + acquisition) assert r.ok - assert set(f['name'] for f in r.json()['files']) == set(file_names) + assert set(f['name'] for f in r.json()['files']) == set(expected_file_names) def test_acquisition_subsequent_file_engine_upload(data_builder, file_form, as_root):