'Test if logbook message is correctly created for sun.'

def test_entry_message_from_state_sun(self):

    pointA = dt_util.utcnow()
    eventA = self.create_state_changed_event(pointA, 'sun.sun', sun.STATE_ABOVE_HORIZON)
    to_state = ha.State.from_dict(eventA.data.get('new_state'))
    message = logbook._entry_message_from_state(to_state.domain, to_state)
    self.assertEqual('has    risen', message)
    eventA = self.create_state_changed_event(pointA, 'sun.sun', sun.STATE_BELOW_HORIZON)
    to_state = ha.State.from_dict(eventA.data.get('new_state'))
    message = logbook._entry_message_from_state(to_state.domain, to_state)
    self.assertEqual('has    set', message)
