mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
RFC: Call services directly (#18720)
* Call services directly * Simplify * Type * Lint * Update name * Fix tests * Catch exceptions in HTTP view * Lint * Handle ServiceNotFound in API endpoints that call services * Type * Don't crash recorder on non-JSON serializable objects
This commit is contained in:
committed by
Pascal Vizeli
parent
53cbb28926
commit
df21dd21f2
@@ -113,11 +113,12 @@ class TestMQTTComponent(unittest.TestCase):
|
||||
"""
|
||||
payload = "not a template"
|
||||
payload_template = "a template"
|
||||
self.hass.services.call(mqtt.DOMAIN, mqtt.SERVICE_PUBLISH, {
|
||||
mqtt.ATTR_TOPIC: "test/topic",
|
||||
mqtt.ATTR_PAYLOAD: payload,
|
||||
mqtt.ATTR_PAYLOAD_TEMPLATE: payload_template
|
||||
}, blocking=True)
|
||||
with pytest.raises(vol.Invalid):
|
||||
self.hass.services.call(mqtt.DOMAIN, mqtt.SERVICE_PUBLISH, {
|
||||
mqtt.ATTR_TOPIC: "test/topic",
|
||||
mqtt.ATTR_PAYLOAD: payload,
|
||||
mqtt.ATTR_PAYLOAD_TEMPLATE: payload_template
|
||||
}, blocking=True)
|
||||
assert not self.hass.data['mqtt'].async_publish.called
|
||||
|
||||
def test_service_call_with_ascii_qos_retain_flags(self):
|
||||
|
||||
Reference in New Issue
Block a user