mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +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:
@@ -4,6 +4,7 @@ from datetime import timedelta
|
||||
import unittest
|
||||
from unittest.mock import patch, sentinel
|
||||
|
||||
from homeassistant.bootstrap import setup_component
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components import history, recorder
|
||||
@@ -27,7 +28,7 @@ class TestComponentHistory(unittest.TestCase):
|
||||
"""Initialize the recorder."""
|
||||
db_uri = 'sqlite://'
|
||||
with patch('homeassistant.core.Config.path', return_value=db_uri):
|
||||
recorder.setup(self.hass, config={
|
||||
setup_component(self.hass, recorder.DOMAIN, {
|
||||
"recorder": {
|
||||
"db_url": db_uri}})
|
||||
self.hass.start()
|
||||
@@ -42,7 +43,7 @@ class TestComponentHistory(unittest.TestCase):
|
||||
def test_setup(self):
|
||||
"""Test setup method of history."""
|
||||
mock_http_component(self.hass)
|
||||
self.assertTrue(history.setup(self.hass, {}))
|
||||
self.assertTrue(setup_component(self.hass, history.DOMAIN, {}))
|
||||
|
||||
def test_last_5_states(self):
|
||||
"""Test retrieving the last 5 states."""
|
||||
|
||||
Reference in New Issue
Block a user