'Test for firing on change with template advanced.'

def test_if_fires_on_change_with_template_advanced(self):

    assert setup_component(self.hass, automation.DOMAIN, {automation.DOMAIN: {'trigger': {'platform': 'template', 'value_template': '{%-    if    is_state("test.entity",    "world")    -%}\n                                                                                                                                                                    true\n                                                                                                                                                                    {%-    else    -%}\n                                                                                                                                                                    false\n                                                                                                                                                                    {%-    endif    -%}'}, 'action': {'service': 'test.automation', 'data_template': {'some': ('{{    trigger.%s    }}' % '}}    -    {{    trigger.'.join(('platform', 'entity_id', 'from_state.state', 'to_state.state')))}}}})
    self.hass.block_till_done()
    self.calls = []
    self.hass.states.set('test.entity', 'world')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
    self.assertEqual('template    -    test.entity    -    hello    -    world', self.calls[0].data['some'])
