コード例 #1
0
 def test_execute_raises_for_bad_glob_val(self, mock_hook):
     operator = LocalToAzureDataLakeStorageOperator(
         task_id=TASK_ID,
         local_path=BAD_LOCAL_PATH,
         remote_path=REMOTE_PATH)
     with pytest.raises(AirflowException) as ctx:
         operator.execute(None)
     assert str(ctx.value
                ) == "Recursive glob patterns using `**` are not supported"
コード例 #2
0
 def test_execute_success(self, mock_hook):
     operator = LocalToAzureDataLakeStorageOperator(task_id=TASK_ID,
                                                    local_path=LOCAL_PATH,
                                                    remote_path=REMOTE_PATH)
     operator.execute(None)
     mock_hook.return_value.upload_file.assert_called_once_with(
         local_path=LOCAL_PATH,
         remote_path=REMOTE_PATH,
         nthreads=64,
         overwrite=True,
         buffersize=4194304,
         blocksize=4194304,
     )
コード例 #3
0
 def test_extra_options_is_passed(self, mock_hook):
     operator = LocalToAzureDataLakeStorageOperator(
         task_id=TASK_ID,
         local_path=LOCAL_PATH,
         remote_path=REMOTE_PATH,
         extra_upload_options={'run': False},
     )
     operator.execute(None)
     mock_hook.return_value.upload_file.assert_called_once_with(
         local_path=LOCAL_PATH,
         remote_path=REMOTE_PATH,
         nthreads=64,
         overwrite=True,
         buffersize=4194304,
         blocksize=4194304,
         run=False,  # extra upload options
     )