'"Test if action.'

def test_if_action(self):

    entity_id = 'domain.test_entity'
    assert setup_component(self.hass, automation.DOMAIN, {automation.DOMAIN: {'trigger': {'platform': 'event', 'event_type': 'test_event'}, 'condition': {'condition': 'numeric_state', 'entity_id': entity_id, 'above': 8, 'below': 12}, 'action': {'service': 'test.automation'}}})
    self.hass.states.set(entity_id, 10)
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
    self.hass.states.set(entity_id, 8)
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
    self.hass.states.set(entity_id, 9)
    self.hass.bus.fire('test_event')
    self.hass.block_till_done()
    self.assertEqual(2, len(self.calls))
