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