def test_dag_link(self): from airflow.www.app import cached_app with cached_app(testing=True).test_request_context(): html = str(utils.dag_link({'dag_id': '<a&1>', 'execution_date': datetime.now()})) self.assertIn('%3Ca%261%3E', html) self.assertNotIn('<a&1>', html)
def test_dag_link_when_dag_is_none(self): """Test that when there is no dag_id, dag_link does not contain hyperlink""" from airflow.www.app import cached_app with cached_app(testing=True).test_request_context(): html = str(utils.dag_link({})) assert 'None' in html assert '<a href=' not in html
def test_dag_link(self): from airflow.www.app import cached_appbuilder with cached_appbuilder(testing=True).app.test_request_context(): html = str(utils.dag_link({ 'dag_id': '<a&1>', 'execution_date': datetime.now() })) self.assertIn('%3Ca%261%3E', html) self.assertNotIn('<a&1>', html)