'Test the availability of variables (serialized as JSON) in templates, but
accessed as a value'

def test_template_with_json_variable_as_value(self):

    val = {'success': False, 'test_value': {'foo': 'bar'}}
    Variable.set('a_variable', val['test_value'], serialize_json=True)
    def verify_templated_field(context):
        self.assertEqual(context['ti'].task.some_templated_field, u'{"foo":    "bar"}')
        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'])
