'Test tracking time change.'

def test_track_time_change(self):

    wildcard_runs = []
    specific_runs = []
    unsub = track_time_change(self.hass, (lambda x: wildcard_runs.append(1)))
    unsub_utc = track_utc_time_change(self.hass, (lambda x: specific_runs.append(1)), second=[0, 30])
    self._send_time_changed(datetime(2014, 5, 24, 12, 0, 0))
    self.hass.block_till_done()
    self.assertEqual(1, len(specific_runs))
    self.assertEqual(1, len(wildcard_runs))
    self._send_time_changed(datetime(2014, 5, 24, 12, 0, 15))
    self.hass.block_till_done()
    self.assertEqual(1, len(specific_runs))
    self.assertEqual(2, len(wildcard_runs))
    self._send_time_changed(datetime(2014, 5, 24, 12, 0, 30))
    self.hass.block_till_done()
    self.assertEqual(2, len(specific_runs))
    self.assertEqual(3, len(wildcard_runs))
    unsub()
    unsub_utc()
    self._send_time_changed(datetime(2014, 5, 24, 12, 0, 30))
    self.hass.block_till_done()
    self.assertEqual(2, len(specific_runs))
    self.assertEqual(3, len(wildcard_runs))
