Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
1 parent
d488c779fc
commit
276f3afb00
161 files changed
+1184
-305
No files matched your search
@@ -57,6 +57,7 @@ async def test_get_conditions(hass, device_reg, entity_reg):
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
expected_conditions = [
|
||||
{
|
||||
@@ -93,6 +94,7 @@ async def test_get_condition_capabilities(hass, device_reg, entity_reg):
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
expected_capabilities = {
|
||||
"extra_fields": [
|
||||
@@ -128,6 +130,7 @@ async def test_get_condition_capabilities_none(hass, device_reg, entity_reg):
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
conditions = [
|
||||
{
|
||||
@@ -160,6 +163,7 @@ async def test_if_state_not_above_below(hass, calls, caplog):
|
||||
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -193,6 +197,7 @@ async def test_if_state_above(hass, calls):
|
||||
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -250,6 +255,7 @@ async def test_if_state_below(hass, calls):
|
||||
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -307,6 +313,7 @@ async def test_if_state_between(hass, calls):
|
||||
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
expected_triggers = [
|
||||
{
|
||||
@@ -98,6 +99,7 @@ async def test_get_trigger_capabilities(hass, device_reg, entity_reg):
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
expected_capabilities = {
|
||||
"extra_fields": [
|
||||
@@ -134,6 +136,7 @@ async def test_get_trigger_capabilities_none(hass, device_reg, entity_reg):
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
triggers = [
|
||||
{
|
||||
@@ -165,6 +168,7 @@ async def test_if_fires_not_on_above_below(hass, calls, caplog):
|
||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -194,6 +198,7 @@ async def test_if_fires_on_state_above(hass, calls):
|
||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -251,6 +256,7 @@ async def test_if_fires_on_state_below(hass, calls):
|
||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -308,6 +314,7 @@ async def test_if_fires_on_state_between(hass, calls):
|
||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
@@ -378,6 +385,7 @@ async def test_if_fires_on_state_change_with_for(hass, calls):
|
||||
|
||||
platform.init()
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
sensor1 = platform.ENTITIES["battery"]
|
||||
|
||||
|
||||
Reference in new issue
Block a user