Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -24,11 +24,12 @@ class TestConfigurator(unittest.TestCase):
|
||||
def test_request_least_info(self):
|
||||
"""Test request config with least amount of data."""
|
||||
request_id = configurator.request_config(
|
||||
self.hass, "Test Request", lambda _: None)
|
||||
self.hass, "Test Request", lambda _: None
|
||||
)
|
||||
|
||||
assert 1 == \
|
||||
len(self.hass.services.services.get(configurator.DOMAIN, [])), \
|
||||
"No new service registered"
|
||||
assert 1 == len(
|
||||
self.hass.services.services.get(configurator.DOMAIN, [])
|
||||
), "No new service registered"
|
||||
|
||||
states = self.hass.states.all()
|
||||
|
||||
@@ -37,8 +38,7 @@ class TestConfigurator(unittest.TestCase):
|
||||
state = states[0]
|
||||
|
||||
assert configurator.STATE_CONFIGURE == state.state
|
||||
assert \
|
||||
request_id == state.attributes.get(configurator.ATTR_CONFIGURE_ID)
|
||||
assert request_id == state.attributes.get(configurator.ATTR_CONFIGURE_ID)
|
||||
|
||||
def test_request_all_info(self):
|
||||
"""Test request config with all possible info."""
|
||||
@@ -63,7 +63,7 @@ class TestConfigurator(unittest.TestCase):
|
||||
link_name="link name",
|
||||
link_url="link url",
|
||||
entity_picture="config entity picture",
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
states = self.hass.states.all()
|
||||
@@ -77,11 +77,14 @@ class TestConfigurator(unittest.TestCase):
|
||||
"""Test if our callback gets called when configure service called."""
|
||||
calls = []
|
||||
request_id = configurator.request_config(
|
||||
self.hass, "Test Request", lambda _: calls.append(1))
|
||||
self.hass, "Test Request", lambda _: calls.append(1)
|
||||
)
|
||||
|
||||
self.hass.services.call(
|
||||
configurator.DOMAIN, configurator.SERVICE_CONFIGURE,
|
||||
{configurator.ATTR_CONFIGURE_ID: request_id})
|
||||
configurator.DOMAIN,
|
||||
configurator.SERVICE_CONFIGURE,
|
||||
{configurator.ATTR_CONFIGURE_ID: request_id},
|
||||
)
|
||||
|
||||
self.hass.block_till_done()
|
||||
assert 1 == len(calls), "Callback not called"
|
||||
@@ -89,7 +92,8 @@ class TestConfigurator(unittest.TestCase):
|
||||
def test_state_change_on_notify_errors(self):
|
||||
"""Test state change on notify errors."""
|
||||
request_id = configurator.request_config(
|
||||
self.hass, "Test Request", lambda _: None)
|
||||
self.hass, "Test Request", lambda _: None
|
||||
)
|
||||
error = "Oh no bad bad bad"
|
||||
configurator.notify_errors(self.hass, request_id, error)
|
||||
|
||||
@@ -103,7 +107,8 @@ class TestConfigurator(unittest.TestCase):
|
||||
def test_request_done_works(self):
|
||||
"""Test if calling request done works."""
|
||||
request_id = configurator.request_config(
|
||||
self.hass, "Test Request", lambda _: None)
|
||||
self.hass, "Test Request", lambda _: None
|
||||
)
|
||||
configurator.request_done(self.hass, request_id)
|
||||
assert 1 == len(self.hass.states.all())
|
||||
|
||||
|
||||
Reference in new issue
Block a user