Browse Source

updating tests

tags/rosie-0.1
btotharye 2 years ago
parent
commit
62e1c203df
2 changed files with 15 additions and 1 deletions
  1. +11
    -1
      test/__init__.py
  2. +4
    -0
      test/intent/020.DimNotSupported.intent.json

+ 11
- 1
test/__init__.py View File

@@ -13,12 +13,18 @@ kitchen_light_attr = {
'entity_id': 'light.kitchen_lights', 'state': 'off'}, 'unit_measure': 10}

temp_entity = {'state': '', 'id': '2', 'dev_name': 'hallway thermostat'}
temp_entity_attr = {
temp_entity_attr = {
"unit_measure": '°F',
"name": 'hallway thermostat',
"state": '75'
}

temp_entity_attr_broke = {
"unit_measure": None,
"name": 'hallway thermostat',
"state": '75'
}

def test_runner(skill, example, emitter, loader):
s = [s for s in loader.skills if s and s.root_dir == skill]

@@ -98,5 +104,9 @@ def test_runner(skill, example, emitter, loader):
s[0].ha.find_entity.return_value = kitchen_light_on
s[0].ha.find_entity_attr.return_value = kitchen_light_attr

if example.endswith('020.DimNotSupported.intent.json'):
s[0].ha = mock.MagicMock()
s[0].ha.find_entity.return_value = kitchen_light_on
s[0].ha.find_entity_attr.return_value = temp_entity_attr_broke

return SkillTest(skill, example, emitter).run(loader)

+ 4
- 0
test/intent/020.DimNotSupported.intent.json View File

@@ -0,0 +1,4 @@
{
"utterance": "dim brightness of kitchen light by 40 percent",
"expected_dialog": "homeassistant.brightness.cantdim.dimmable"
}

Loading…
Cancel
Save