1
0
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:
Pascal Vizeli
2016-09-25 23:15:21 +02:00
committed by GitHub
parent 0c0feda834
commit bbfd86dec3
16 changed files with 62 additions and 46 deletions

View File

@@ -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')