コード例 #1
0
 def test_service_call_with_template_payload_renders_template(self):
     """
     If 'payload_template' is provided and 'payload' is not, then render it.
     """
     mqtt.publish_template(self.hass, "test/topic", "{{ 1+1 }}")
     self.hass.pool.block_till_done()
     self.assertTrue(mqtt.MQTT_CLIENT.publish.called)
     self.assertEqual(mqtt.MQTT_CLIENT.publish.call_args[0][1], "2")
コード例 #2
0
ファイル: test_mqtt.py プロジェクト: t30/home-assistant
 def test_service_call_with_template_payload_renders_template(self):
     """
     If 'payload_template' is provided and 'payload' is not, then render it.
     """
     mqtt.publish_template(self.hass, "test/topic", "{{ 1+1 }}")
     self.hass.pool.block_till_done()
     self.assertTrue(mqtt.MQTT_CLIENT.publish.called)
     self.assertEqual(mqtt.MQTT_CLIENT.publish.call_args[0][1], "2")
コード例 #3
0
    def test_service_call_with_template_payload_renders_template(self):
        """Test the service call with rendered template.

        If 'payload_template' is provided and 'payload' is not, then render it.
        """
        mqtt.publish_template(self.hass, "test/topic", "{{ 1+1 }}")
        self.hass.block_till_done()
        assert self.hass.data['mqtt'].async_publish.called
        assert self.hass.data['mqtt'].async_publish.call_args[0][1] == '2'
コード例 #4
0
ファイル: test_init.py プロジェクト: boced66/home-assistant
    def test_service_call_with_template_payload_renders_template(self):
        """Test the service call with rendered template.

        If 'payload_template' is provided and 'payload' is not, then render it.
        """
        mqtt.publish_template(self.hass, "test/topic", "{{ 1+1 }}")
        self.hass.block_till_done()
        assert self.hass.data['mqtt'].async_publish.called
        assert self.hass.data['mqtt'].async_publish.call_args[0][1] == "2"