def test_lineage_is_sent_to_backend(self, mock_get_backend): class TestBackend(LineageBackend): def send_lineage(self, operator, inlets=None, outlets=None, context=None): assert len(inlets) == 1 assert len(outlets) == 1 func = mock.Mock() func.__name__ = 'foo' mock_get_backend.return_value = TestBackend() dag = DAG(dag_id='test_lineage_is_sent_to_backend', start_date=DEFAULT_DATE) with dag: op1 = DummyOperator(task_id='task1') file1 = File("/tmp/some_file") op1.inlets.append(file1) op1.outlets.append(file1) ctx1 = { "ti": TI(task=op1, execution_date=DEFAULT_DATE), "execution_date": DEFAULT_DATE } prep = prepare_lineage(func) prep(op1, ctx1) post = apply_lineage(func) post(op1, ctx1)