mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix broken conversation test
This commit is contained in:
parent
5b2b12eed1
commit
3e3ee9184a
@ -7,7 +7,6 @@ Tests Conversation component.
|
||||
# pylint: disable=too-many-public-methods,protected-access
|
||||
import unittest
|
||||
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components as core_components
|
||||
import homeassistant.components.conversation as conversation
|
||||
import homeassistant.components.demo as demo
|
||||
@ -34,35 +33,36 @@ class TestConversation(unittest.TestCase):
|
||||
self.assertTrue(
|
||||
conversation.setup(self.hass, {conversation.DOMAIN: {}}))
|
||||
|
||||
light.turn_off(self.hass, '{}.kitchen'.format(light.DOMAIN))
|
||||
light.turn_off(self.hass, 'light.kitchen_lights')
|
||||
|
||||
event_data = {conversation.ATTR_TEXT: 'turn kitchen on'}
|
||||
event_data = {conversation.ATTR_TEXT: 'turn kitchen lights on'}
|
||||
self.hass.services.call(
|
||||
conversation.DOMAIN, 'process', event_data, True)
|
||||
|
||||
self.assertTrue(
|
||||
light.is_on(self.hass, '{}.kitchen'.format(light.DOMAIN)))
|
||||
light.is_on(self.hass, 'light.kitchen_lights'))
|
||||
|
||||
def test_setup_and_turn_off(self):
|
||||
""" Setup and perform good turn off requests """
|
||||
self.assertTrue(
|
||||
conversation.setup(self.hass, {conversation.DOMAIN: {}}))
|
||||
|
||||
light.turn_on(self.hass, '{}.kitchen'.format(light.DOMAIN))
|
||||
light.turn_on(self.hass, 'light.kitchen_lights')
|
||||
|
||||
event_data = {conversation.ATTR_TEXT: 'turn kitchen off'}
|
||||
event_data = {conversation.ATTR_TEXT: 'turn kitchen lights off'}
|
||||
self.hass.services.call(
|
||||
conversation.DOMAIN, 'process', event_data, True)
|
||||
|
||||
self.assertFalse(
|
||||
light.is_on(self.hass, '{}.kitchen'.format(light.DOMAIN)))
|
||||
light.is_on(self.hass, 'light.kitchen_lights'))
|
||||
|
||||
def test_setup_and_bad_request_format(self):
|
||||
""" Setup and perform a badly formatted request """
|
||||
self.assertTrue(
|
||||
conversation.setup(self.hass, {conversation.DOMAIN: {}}))
|
||||
|
||||
event_data = {conversation.ATTR_TEXT:
|
||||
event_data = {
|
||||
conversation.ATTR_TEXT:
|
||||
'what is the answer to the ultimate question of life, ' +
|
||||
'the universe and everything'}
|
||||
self.assertTrue(self.hass.services.call(
|
||||
|
Loading…
x
Reference in New Issue
Block a user