mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Fix various flapping tests that are missing block_till_done (#36346)
* Add missing async_block_till_done to various tests * Add missing async_block_till_done to various tests
This commit is contained in:
parent
dcbe2136cf
commit
141c4c2f33
@ -23,6 +23,7 @@ async def test_fetching_url(aioclient_mock, hass, hass_client):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
client = await hass_client()
|
||||
|
||||
@ -55,6 +56,7 @@ async def test_fetching_without_verify_ssl(aioclient_mock, hass, hass_client):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
client = await hass_client()
|
||||
|
||||
@ -81,6 +83,7 @@ async def test_fetching_url_with_verify_ssl(aioclient_mock, hass, hass_client):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
client = await hass_client()
|
||||
|
||||
@ -108,6 +111,7 @@ async def test_limit_refetch(aioclient_mock, hass, hass_client):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
client = await hass_client()
|
||||
|
||||
@ -171,6 +175,7 @@ async def test_camera_content_type(aioclient_mock, hass, hass_client):
|
||||
await async_setup_component(
|
||||
hass, "camera", {"camera": [cam_config_svg, cam_config_normal]}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
client = await hass_client()
|
||||
|
||||
|
@ -54,6 +54,7 @@ class TestUVCSetup(unittest.TestCase):
|
||||
mock_remote.return_value.server_version = (3, 2, 0)
|
||||
|
||||
assert setup_component(self.hass, "camera", {"camera": config})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert mock_remote.call_count == 1
|
||||
assert mock_remote.call_args == mock.call("foo", 123, "secret", ssl=False)
|
||||
@ -78,6 +79,7 @@ class TestUVCSetup(unittest.TestCase):
|
||||
mock_remote.return_value.server_version = (3, 2, 0)
|
||||
|
||||
assert setup_component(self.hass, "camera", {"camera": config})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert mock_remote.call_count == 1
|
||||
assert mock_remote.call_args == mock.call("foo", 7080, "secret", ssl=False)
|
||||
@ -102,6 +104,7 @@ class TestUVCSetup(unittest.TestCase):
|
||||
mock_remote.return_value.server_version = (3, 1, 3)
|
||||
|
||||
assert setup_component(self.hass, "camera", {"camera": config})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert mock_remote.call_count == 1
|
||||
assert mock_remote.call_args == mock.call("foo", 7080, "secret", ssl=False)
|
||||
@ -116,14 +119,20 @@ class TestUVCSetup(unittest.TestCase):
|
||||
def test_setup_incomplete_config(self, mock_uvc):
|
||||
"""Test the setup with incomplete configuration."""
|
||||
assert setup_component(self.hass, "camera", {"platform": "uvc", "nvr": "foo"})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not mock_uvc.called
|
||||
assert setup_component(
|
||||
self.hass, "camera", {"platform": "uvc", "key": "secret"}
|
||||
)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not mock_uvc.called
|
||||
assert setup_component(
|
||||
self.hass, "camera", {"platform": "uvc", "port": "invalid"}
|
||||
)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not mock_uvc.called
|
||||
|
||||
@mock.patch.object(uvc, "UnifiVideoCamera")
|
||||
@ -133,6 +142,8 @@ class TestUVCSetup(unittest.TestCase):
|
||||
config = {"platform": "uvc", "nvr": "foo", "key": "secret"}
|
||||
mock_remote.return_value.index.side_effect = error
|
||||
assert setup_component(self.hass, "camera", {"camera": config})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not mock_uvc.called
|
||||
|
||||
def test_setup_nvr_error_during_indexing_notauthorized(self):
|
||||
@ -157,6 +168,8 @@ class TestUVCSetup(unittest.TestCase):
|
||||
mock_remote.return_value = None
|
||||
mock_remote.side_effect = error
|
||||
assert setup_component(self.hass, "camera", {"camera": config})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not mock_remote.index.called
|
||||
assert not mock_uvc.called
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user