@@ -0,0 +1,2260 @@
+%22%22%22%0Atests.test_updater%0A~~~~~~~~~~~~~~~~~~%0A%0ATests updater component.%0A%22%22%22%0Aimport unittest%0Afrom unittest.mock import patch%0A%0Aimport requests%0A%0Aimport homeassistant.core as ha%0Afrom homeassistant.const import __version__ as CURRENT_VERSION%0Afrom homeassistant.components import updater%0Aimport homeassistant.util.dt as dt_util%0Afrom tests.common import fire_time_changed%0A%0ANEW_VERSION = '10000.0'%0A%0A%0Aclass TestUpdater(unittest.TestCase):%0A    %22%22%22 Test the demo lock. %22%22%22%0A%0A    def setUp(self):  # pylint: disable=invalid-name%0A        self.hass = ha.HomeAssistant()%0A%0A    def tearDown(self):  # pylint: disable=invalid-name%0A        %22%22%22 Stop down stuff we started. %22%22%22%0A        self.hass.stop()%0A%0A    @patch('homeassistant.components.updater.get_newest_version')%0A    def test_new_version_shows_entity_on_start(self, mock_get_newest_version):%0A        mock_get_newest_version.return_value = NEW_VERSION%0A%0A        self.assertTrue(updater.setup(self.hass, %7B%0A            'updater': None%0A        %7D))%0A%0A        self.assertTrue(self.hass.states.is_state(updater.ENTITY_ID,%0A                                                  NEW_VERSION))%0A%0A    @patch('homeassistant.components.updater.get_newest_version')%0A    def test_no_entity_on_same_version(self, mock_get_newest_version):%0A        mock_get_newest_version.return_value = CURRENT_VERSION%0A%0A        self.assertTrue(updater.setup(self.hass, %7B%0A            'updater': None%0A        %7D))%0A%0A        self.assertIsNone(self.hass.states.get(updater.ENTITY_ID))%0A%0A        mock_get_newest_version.return_value = NEW_VERSION%0A%0A        fire_time_changed(self.hass,%0A                          dt_util.utcnow().replace(hour=0, minute=0, second=0))%0A%0A        self.hass.pool.block_till_done()%0A%0A        self.assertTrue(self.hass.states.is_state(updater.ENTITY_ID,%0A                                                  NEW_VERSION))%0A%0A    @patch('homeassistant.components.updater.requests.get')%0A    def test_errors_while_fetching_new_version(self, mock_get):%0A        mock_get.side_effect = requests.RequestException%0A%0A        self.assertIsNone(updater.get_newest_version())%0A%0A        mock_get.side_effect = ValueError%0A%0A        self.assertIsNone(updater.get_newest_version())%0A%0A        mock_get.side_effect = KeyError%0A%0A        self.assertIsNone(updater.get_newest_version())%0A

Add updater tests