You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/06/28 18:47:06 UTC
[GitHub] [airflow] kurtqq commented on a change in pull request #16686: Add conn to jinja template context
kurtqq commented on a change in pull request #16686:
URL: https://github.com/apache/airflow/pull/16686#discussion_r660033112
##########
File path: tests/models/test_taskinstance.py
##########
@@ -1547,6 +1550,47 @@ def test_pendulum_template_dates(self):
assert isinstance(template_context["next_execution_date"], pendulum.DateTime)
assert isinstance(template_context["prev_execution_date"], pendulum.DateTime)
+ @parameterized.expand(
+ [
+ ('{{ conn.get("a_connection").host }}', 'hostvalue'),
+ ('{{ conn.get("a_connection", "unused_fallback").host }}', 'hostvalue'),
+ ('{{ conn.get("missing_connection", {"host": "fallback_host"}).host }}', 'fallback_host'),
+ ('{{ conn.a_connection.host }}', 'hostvalue'),
+ ('{{ conn.a_connection.login }}', 'loginvalue'),
+ ('{{ conn.a_connection.password }}', 'passwordvalue'),
+ ('{{ conn.a_connection.extra_dejson["extra__asana__workspace"] }}', 'extra1'),
+ ]
+ )
+ def test_template_with_connection(self, content, expected_output):
Review comment:
this test cover only connection defined in the database.
connection can also be in secret backend - will the macro work with it? shouldn't it be also covered in test?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org