6 import arvados.collection
8 class TestSDK(unittest.TestCase):
10 @mock.patch('arvados.api')
11 @mock.patch('arvados.current_task')
12 @mock.patch('arvados.current_job')
13 def test_one_task_per_input_file_normalize(self, mock_job, mock_task, mock_api):
14 # This manifest will be reduced from three lines to one when it is
16 nonnormalized_manifest = """. 5348b82a029fd9e971a811ce1f71360b+43 0:43:md5sum.txt
17 . 085c37f02916da1cad16f93c54d899b7+41 0:41:md5sum.txt
18 . 8b22da26f9f433dea0a10e5ec66d73ba+43 0:43:md5sum.txt
20 dummy_hash = 'ffffffffffffffffffffffffffffffff+0'
22 mock_job.return_value = {
24 'script_parameters': {
28 mock_task.return_value = {
32 # mock the API client to return a collection with a nonnormalized manifest.
33 mock_api('v1').collections().get().execute.return_value = {
34 'uuid': 'zzzzz-4zz18-mockcollection0',
35 'portable_data_hash': dummy_hash,
36 'manifest_text': nonnormalized_manifest,
39 # Because one_task_per_input_file normalizes this collection,
40 # it should now create only one job task and not three.
41 arvados.job_setup.one_task_per_input_file(and_end_task=False)
42 mock_api('v1').job_tasks().create().execute.assert_called_once_with()