'Test arm home method.'

def test_trigger_with_pending(self):

    self.assertTrue(setup_component(self.hass, alarm_control_panel.DOMAIN, {'alarm_control_panel': {'platform': 'manual', 'name': 'test', 'pending_time': 2, 'trigger_time': 3, 'disarm_after_trigger': False}}))
    entity_id = 'alarm_control_panel.test'
    self.assertEqual(STATE_ALARM_DISARMED, self.hass.states.get(entity_id).state)
    alarm_control_panel.alarm_trigger(self.hass)
    self.hass.block_till_done()
    self.assertEqual(STATE_ALARM_PENDING, self.hass.states.get(entity_id).state)
    future = (dt_util.utcnow() + timedelta(seconds=2))
    with patch('homeassistant.components.alarm_control_panel.manual.dt_util.utcnow', return_value=future):
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()
    self.assertEqual(STATE_ALARM_TRIGGERED, self.hass.states.get(entity_id).state)
    future = (dt_util.utcnow() + timedelta(seconds=5))
    with patch('homeassistant.components.alarm_control_panel.manual.dt_util.utcnow', return_value=future):
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()
    self.assertEqual(STATE_ALARM_DISARMED, self.hass.states.get(entity_id).state)
