This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b9fe45  Added `files` to templated fields of `EmailOperator` (#12435)
9b9fe45 is described below

commit 9b9fe45f46455bdb7d3702ba4f4524574f11f75c
Author: Brighton Balfrey <[email protected]>
AuthorDate: Wed Nov 18 00:01:41 2020 -0800

    Added `files` to templated fields of `EmailOperator` (#12435)
---
 tests/operators/test_email.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/operators/test_email.py b/tests/operators/test_email.py
index c02b04f..465cdde 100644
--- a/tests/operators/test_email.py
+++ b/tests/operators/test_email.py
@@ -50,6 +50,7 @@ class TestEmailOperator(unittest.TestCase):
             html_content='The quick brown fox jumps over the lazy dog',
             task_id='task',
             dag=self.dag,
+            files=["/tmp/Report-A-{{ execution_date.strftime('%Y-%m-%d') 
}}.csv"],
             **kwargs,
         )
         task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
@@ -58,3 +59,5 @@ class TestEmailOperator(unittest.TestCase):
         with conf_vars({('email', 'email_backend'): 
'tests.operators.test_email.send_email_test'}):
             self._run_as_operator()
         assert send_email_test.call_count == 1
+        resulting_files = send_email_test.call_args[1]['files']  # pylint: 
disable=unsubscriptable-object
+        assert resulting_files[0] == '/tmp/Report-A-2016-01-01.csv'

Reply via email to