'Test the sunset trigger.'

def test_sunset_trigger(self):

    now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
    trigger_time = datetime(2015, 9, 16, 2, tzinfo=dt_util.UTC)
    with patch('homeassistant.util.dt.utcnow', return_value=now):
        setup_component(self.hass, automation.DOMAIN, {automation.DOMAIN: {'trigger': {'platform': 'sun', 'event': 'sunset'}, 'action': {'service': 'test.automation'}}})
    automation.turn_off(self.hass)
    self.hass.block_till_done()
    fire_time_changed(self.hass, trigger_time)
    self.hass.block_till_done()
    self.assertEqual(0, len(self.calls))
    with patch('homeassistant.util.dt.utcnow', return_value=now):
        automation.turn_on(self.hass)
        self.hass.block_till_done()
    fire_time_changed(self.hass, trigger_time)
    self.hass.block_till_done()
    self.assertEqual(1, len(self.calls))
