Fix broken tests (#11395)

* Do not leave remember the milk config file behind

* Fix exception in service causing service timeout

* Change max service timeout to 9 to catch services timing out

* Fix Google Sync service test

* Update and pin test requirements
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-01-01 14:30:09 -08:00
1 parent b9c852392c
commit 6e63a4ed8a
5 files changed
+33 -32

No files matched your search

+11 -9
View File
@@ -38,7 +38,8 @@ class TestConfiguration(unittest.TestCase):
def test_create_new(self):
"""Test creating a new config file."""
with patch("builtins.open", mock_open()), \
patch("os.path.isfile", Mock(return_value=False)):
patch("os.path.isfile", Mock(return_value=False)), \
patch.object(rtm.RememberTheMilkConfiguration, 'save_config'):
config = rtm.RememberTheMilkConfiguration(self.hass)
config.set_token(self.profile, self.token)
self.assertEqual(config.get_token(self.profile), self.token)
@@ -65,16 +66,17 @@ class TestConfiguration(unittest.TestCase):
timeseries_id = "my_timeseries"
rtm_id = "rtm-id-4567"
with patch("builtins.open", mock_open()), \
patch("os.path.isfile", Mock(return_value=False)):
patch("os.path.isfile", Mock(return_value=False)), \
patch.object(rtm.RememberTheMilkConfiguration, 'save_config'):
config = rtm.RememberTheMilkConfiguration(self.hass)
self.assertEqual(None, config.get_rtm_id(self.profile, hass_id))
config.set_rtm_id(self.profile, hass_id, list_id, timeseries_id,
rtm_id)
self.assertEqual((list_id, timeseries_id, rtm_id),
config.get_rtm_id(self.profile, hass_id))
config.delete_rtm_id(self.profile, hass_id)
self.assertEqual(None, config.get_rtm_id(self.profile, hass_id))
self.assertEqual(None, config.get_rtm_id(self.profile, hass_id))
config.set_rtm_id(self.profile, hass_id, list_id, timeseries_id,
rtm_id)
self.assertEqual((list_id, timeseries_id, rtm_id),
config.get_rtm_id(self.profile, hass_id))
config.delete_rtm_id(self.profile, hass_id)
self.assertEqual(None, config.get_rtm_id(self.profile, hass_id))
def test_load_key_map(self):
"""Test loading an existing key map from the file."""
+1
View File
@@ -109,6 +109,7 @@ class TestShellCommand(unittest.TestCase):
def test_template_render(self, mock_call):
"""Ensure shell_commands with templates get rendered properly."""
self.hass.states.set('sensor.test_state', 'Works')
mock_call.return_value = mock_process_creator(error=False)
self.assertTrue(
setup_component(self.hass, shell_command.DOMAIN, {
shell_command.DOMAIN: {