This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v1-10-test by this push:
new 53c4e1c [AIRFLOW-3900] Error on undefined template variables in unit
tests. (#4719)
53c4e1c is described below
commit 53c4e1cfd7f24d68207d9bed63862099c5e6401f
Author: Joshua Carp <[email protected]>
AuthorDate: Sat Feb 16 00:03:28 2019 -0500
[AIRFLOW-3900] Error on undefined template variables in unit tests. (#4719)
(cherry-picked from a7586648726aa99f0976150ad376c0ce553544b0)
---
airflow/www_rbac/templates/airflow/dag.html | 2 +-
tests/www_rbac/test_views.py | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/airflow/www_rbac/templates/airflow/dag.html
b/airflow/www_rbac/templates/airflow/dag.html
index b5f4d00..7de2cc8 100644
--- a/airflow/www_rbac/templates/airflow/dag.html
+++ b/airflow/www_rbac/templates/airflow/dag.html
@@ -28,7 +28,7 @@
{% block content %}
<div>
<h3 class="pull-left">
- {% if dag.parent_dag %}
+ {% if dag.parent_dag is defined and dag.parent_dag %}
<span style='color:#AAA;'>SUBDAG: </span> <span> {{ dag.dag_id
}}</span>
{% else %}
<input id="pause_resume" dag_id="{{ dag.dag_id }}" type="checkbox" {{
"checked" if not dag.is_paused else "" }} data-toggle="toggle" data-size="mini"
method="post">
diff --git a/tests/www_rbac/test_views.py b/tests/www_rbac/test_views.py
index 68a605a..9a199f6 100644
--- a/tests/www_rbac/test_views.py
+++ b/tests/www_rbac/test_views.py
@@ -32,6 +32,7 @@ from datetime import timedelta
import pytest
import six
+import jinja2
from flask import Markup, session as flask_session, url_for
from flask._compat import PY2
from parameterized import parameterized
@@ -66,6 +67,7 @@ class TestBase(unittest.TestCase):
def setUpClass(cls):
cls.app, cls.appbuilder = application.create_app(session=Session,
testing=True)
cls.app.config['WTF_CSRF_ENABLED'] = False
+ cls.app.jinja_env.undefined = jinja2.StrictUndefined
settings.configure_orm()
cls.session = Session