From 61262222aa242956e92dd7d54d73df10a47997d2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 9 Oct 2020 08:50:43 -0500 Subject: [PATCH] Remove async_add_job from system_log tests (#41551) --- tests/components/system_log/test_init.py | 30 +++++++++--------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/tests/components/system_log/test_init.py b/tests/components/system_log/test_init.py index 49cd2d8ea8b..85e86d9c78f 100644 --- a/tests/components/system_log/test_init.py +++ b/tests/components/system_log/test_init.py @@ -230,9 +230,7 @@ async def test_clear_logs(hass, simple_queue, hass_client): _LOGGER.error("error message") await _async_block_until_queue_empty(hass, simple_queue) - hass.async_add_job( - hass.services.async_call(system_log.DOMAIN, system_log.SERVICE_CLEAR, {}) - ) + await hass.services.async_call(system_log.DOMAIN, system_log.SERVICE_CLEAR, {}) await _async_block_until_queue_empty(hass, simple_queue) # Assert done by get_error_log @@ -244,10 +242,8 @@ async def test_write_log(hass): await async_setup_component(hass, system_log.DOMAIN, BASIC_CONFIG) logger = MagicMock() with patch("logging.getLogger", return_value=logger) as mock_logging: - hass.async_add_job( - hass.services.async_call( - system_log.DOMAIN, system_log.SERVICE_WRITE, {"message": "test_message"} - ) + await hass.services.async_call( + system_log.DOMAIN, system_log.SERVICE_WRITE, {"message": "test_message"} ) await hass.async_block_till_done() mock_logging.assert_called_once_with("homeassistant.components.system_log.external") @@ -258,12 +254,10 @@ async def test_write_choose_logger(hass): """Test that correct logger is chosen.""" await async_setup_component(hass, system_log.DOMAIN, BASIC_CONFIG) with patch("logging.getLogger") as mock_logging: - hass.async_add_job( - hass.services.async_call( - system_log.DOMAIN, - system_log.SERVICE_WRITE, - {"message": "test_message", "logger": "myLogger"}, - ) + await hass.services.async_call( + system_log.DOMAIN, + system_log.SERVICE_WRITE, + {"message": "test_message", "logger": "myLogger"}, ) await hass.async_block_till_done() mock_logging.assert_called_once_with("myLogger") @@ -274,12 +268,10 @@ async def test_write_choose_level(hass): await async_setup_component(hass, system_log.DOMAIN, BASIC_CONFIG) logger = MagicMock() with patch("logging.getLogger", return_value=logger): - hass.async_add_job( - hass.services.async_call( - system_log.DOMAIN, - system_log.SERVICE_WRITE, - {"message": "test_message", "level": "debug"}, - ) + await hass.services.async_call( + system_log.DOMAIN, + system_log.SERVICE_WRITE, + {"message": "test_message", "level": "debug"}, ) await hass.async_block_till_done() assert logger.method_calls[0] == ("debug", ("test_message",))