'Test the availability of variables in templates'

def test_template_with_variable(self):

    val = {'success': False, 'test_value': 'a    test    value'}
    Variable.set('a_variable', val['test_value'])
    def verify_templated_field(context):
        self.assertEqual(context['ti'].task.some_templated_field, val['test_value'])
        val['success'] = True
    t = OperatorSubclass(task_id='test_complex_template', some_templated_field='{{    var.value.a_variable    }}', on_success_callback=verify_templated_field, dag=self.dag)
    t.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, ignore_ti_state=True)
    self.assertTrue(val['success'])
