mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Use setup_component in tests v1 (#3507)
* update unittests like #3414 * setup_component - splunk * setup_component - statsd * fix statsd & splunk unittest config values * component_setup - device_sun_light_trigger * setup_component - introduction * component_setup - persistent_notification * setup_component - logentries, mqtt eventstream * fix unittest logentries
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from homeassistant.bootstrap import setup_component
|
||||
import homeassistant.components.splunk as splunk
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, EVENT_STATE_CHANGED
|
||||
|
||||
@@ -16,12 +17,12 @@ class TestSplunk(unittest.TestCase):
|
||||
'host': 'host',
|
||||
'port': 123,
|
||||
'token': 'secret',
|
||||
'use_ssl': 'False',
|
||||
'ssl': 'False',
|
||||
}
|
||||
}
|
||||
|
||||
hass = mock.MagicMock()
|
||||
self.assertTrue(splunk.setup(hass, config))
|
||||
self.assertTrue(setup_component(hass, splunk.DOMAIN, config))
|
||||
self.assertTrue(hass.bus.listen.called)
|
||||
self.assertEqual(EVENT_STATE_CHANGED,
|
||||
hass.bus.listen.call_args_list[0][0][0])
|
||||
@@ -36,7 +37,7 @@ class TestSplunk(unittest.TestCase):
|
||||
}
|
||||
|
||||
hass = mock.MagicMock()
|
||||
self.assertTrue(splunk.setup(hass, config))
|
||||
self.assertTrue(setup_component(hass, splunk.DOMAIN, config))
|
||||
self.assertTrue(hass.bus.listen.called)
|
||||
self.assertEqual(EVENT_STATE_CHANGED,
|
||||
hass.bus.listen.call_args_list[0][0][0])
|
||||
@@ -55,7 +56,7 @@ class TestSplunk(unittest.TestCase):
|
||||
}
|
||||
|
||||
self.hass = mock.MagicMock()
|
||||
splunk.setup(self.hass, config)
|
||||
setup_component(self.hass, splunk.DOMAIN, config)
|
||||
self.handler_method = self.hass.bus.listen.call_args_list[0][0][1]
|
||||
|
||||
@mock.patch.object(splunk, 'requests')
|
||||
|
||||
Reference in New Issue
Block a user