'Test for to action.'

def test_if_action(self):

    entity_id = 'domain.test_entity'
    test_state = 'new_state'
    assert setup_component(self.hass, automation.DOMAIN, {automation.DOMAIN: {'trigger': {'platform': 'event', 'event_type': 'test_event'}, 'condition': [{'condition': 'state', 'entity_id': entity_id, 'state': test_state}], 'action': {'service': 'test.automation'}}})
    self.hass.states.set(entity_id, test_state)
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
    self.hass.states.set(entity_id, (test_state + 'something'))
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
