'Test for firing if action.'

def test_if_action(self):

    assert setup_component(self.hass, automation.DOMAIN, {automation.DOMAIN: {'trigger': {'platform': 'event', 'event_type': 'test_event'}, 'condition': [{'condition': 'template', 'value_template': '{{    is_state("test.entity",    "world")    }}'}], 'action': {'service': 'test.automation'}}})
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(0, len(self.calls))
    self.hass.states.set('test.entity', 'world')
    self.hass.block_till_done()
    self.assertEqual(0, len(self.calls))
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
