mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Make names command line platform consistent
This commit is contained in:
parent
afb51d14b8
commit
be55ee059e
@ -9,7 +9,7 @@ import logging
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.sensor.command_sensor import CommandSensorData
|
||||
from homeassistant.components.sensor.command_line import CommandSensorData
|
||||
from homeassistant.const import CONF_VALUE_TEMPLATE
|
||||
from homeassistant.helpers import template
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
tests.components.binary_sensor.command_sensor
|
||||
tests.components.binary_sensor.command_line
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Tests command binary sensor.
|
||||
@ -7,7 +7,7 @@ Tests command binary sensor.
|
||||
import unittest
|
||||
|
||||
from homeassistant.const import (STATE_ON, STATE_OFF)
|
||||
from homeassistant.components.binary_sensor import command_sensor
|
||||
from homeassistant.components.binary_sensor import command_line
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
@ -35,7 +35,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
||||
for dev in devs:
|
||||
devices.append(dev)
|
||||
|
||||
command_sensor.setup_platform(
|
||||
command_line.setup_platform(
|
||||
self.hass, config, add_dev_callback)
|
||||
|
||||
self.assertEqual(1, len(devices))
|
||||
@ -54,25 +54,25 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
||||
for dev in devs:
|
||||
devices.append(dev)
|
||||
|
||||
self.assertFalse(command_sensor.setup_platform(
|
||||
self.assertFalse(command_line.setup_platform(
|
||||
self.hass, config, add_dev_callback))
|
||||
|
||||
self.assertEqual(0, len(devices))
|
||||
|
||||
def test_template(self):
|
||||
""" Test command sensor with template """
|
||||
data = command_sensor.CommandSensorData('echo 10')
|
||||
data = command_line.CommandSensorData('echo 10')
|
||||
|
||||
entity = command_sensor.CommandBinarySensor(
|
||||
entity = command_line.CommandBinarySensor(
|
||||
self.hass, data, 'test', '1.0', '0', '{{ value | multiply(0.1) }}')
|
||||
|
||||
self.assertEqual(STATE_ON, entity.state)
|
||||
|
||||
def test_sensor_off(self):
|
||||
""" Test command sensor with template """
|
||||
data = command_sensor.CommandSensorData('echo 0')
|
||||
data = command_line.CommandSensorData('echo 0')
|
||||
|
||||
entity = command_sensor.CommandBinarySensor(
|
||||
entity = command_line.CommandBinarySensor(
|
||||
self.hass, data, 'test', '1', '0', None)
|
||||
|
||||
self.assertEqual(STATE_OFF, entity.state)
|
@ -1,7 +1,7 @@
|
||||
"""
|
||||
tests.components.rollershutter.command_rollershutter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Tests the command_rollershutter component
|
||||
tests.components.rollershutter.command_line
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Tests the command_line component
|
||||
"""
|
||||
|
||||
import os
|
||||
@ -12,7 +12,7 @@ from unittest import mock
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.rollershutter as rollershutter
|
||||
from homeassistant.components.rollershutter import (
|
||||
command_rollershutter as cmd_rs)
|
||||
command_line as cmd_rs)
|
||||
|
||||
|
||||
class TestCommandRollerShutter(unittest.TestCase):
|
||||
@ -53,7 +53,7 @@ class TestCommandRollerShutter(unittest.TestCase):
|
||||
}
|
||||
self.assertTrue(rollershutter.setup(self.hass, {
|
||||
'rollershutter': {
|
||||
'platform': 'command_rollershutter',
|
||||
'platform': 'command_line',
|
||||
'rollershutters': {
|
||||
'test': test_rollershutter
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
"""
|
||||
tests.components.sensor.test_command_sensor
|
||||
tests.components.sensor.test_command_line
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Tests command sensor.
|
||||
"""
|
||||
import unittest
|
||||
|
||||
from homeassistant.components.sensor import command_sensor
|
||||
from homeassistant.components.sensor import command_line
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
@ -33,7 +33,7 @@ class TestCommandSensorSensor(unittest.TestCase):
|
||||
for dev in devs:
|
||||
devices.append(dev)
|
||||
|
||||
command_sensor.setup_platform(
|
||||
command_line.setup_platform(
|
||||
self.hass, config, add_dev_callback)
|
||||
|
||||
self.assertEqual(1, len(devices))
|
||||
@ -53,23 +53,23 @@ class TestCommandSensorSensor(unittest.TestCase):
|
||||
for dev in devs:
|
||||
devices.append(dev)
|
||||
|
||||
self.assertFalse(command_sensor.setup_platform(
|
||||
self.assertFalse(command_line.setup_platform(
|
||||
self.hass, config, add_dev_callback))
|
||||
|
||||
self.assertEqual(0, len(devices))
|
||||
|
||||
def test_template(self):
|
||||
""" Test command sensor with template. """
|
||||
data = command_sensor.CommandSensorData('echo 50')
|
||||
data = command_line.CommandSensorData('echo 50')
|
||||
|
||||
entity = command_sensor.CommandSensor(
|
||||
entity = command_line.CommandSensor(
|
||||
self.hass, data, 'test', 'in', '{{ value | multiply(0.1) }}')
|
||||
|
||||
self.assertEqual(5, float(entity.state))
|
||||
|
||||
def test_bad_command(self):
|
||||
""" Test bad command. """
|
||||
data = command_sensor.CommandSensorData('asdfasdf')
|
||||
data = command_line.CommandSensorData('asdfasdf')
|
||||
data.update()
|
||||
|
||||
self.assertEqual(None, data.value)
|
@ -1,6 +1,6 @@
|
||||
"""
|
||||
tests.components.switch.test_command_switch
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
tests.components.switch.test_command_line
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Tests command switch.
|
||||
"""
|
||||
@ -34,7 +34,7 @@ class TestCommandSwitch(unittest.TestCase):
|
||||
}
|
||||
self.assertTrue(switch.setup(self.hass, {
|
||||
'switch': {
|
||||
'platform': 'command_switch',
|
||||
'platform': 'command_line',
|
||||
'switches': {
|
||||
'test': test_switch
|
||||
}
|
||||
@ -67,7 +67,7 @@ class TestCommandSwitch(unittest.TestCase):
|
||||
}
|
||||
self.assertTrue(switch.setup(self.hass, {
|
||||
'switch': {
|
||||
'platform': 'command_switch',
|
||||
'platform': 'command_line',
|
||||
'switches': {
|
||||
'test': test_switch
|
||||
}
|
||||
@ -102,7 +102,7 @@ class TestCommandSwitch(unittest.TestCase):
|
||||
}
|
||||
self.assertTrue(switch.setup(self.hass, {
|
||||
'switch': {
|
||||
'platform': 'command_switch',
|
||||
'platform': 'command_line',
|
||||
'switches': {
|
||||
'test': test_switch
|
||||
}
|
||||
@ -134,7 +134,7 @@ class TestCommandSwitch(unittest.TestCase):
|
||||
}
|
||||
self.assertTrue(switch.setup(self.hass, {
|
||||
'switch': {
|
||||
'platform': 'command_switch',
|
||||
'platform': 'command_line',
|
||||
'switches': {
|
||||
'test': test_switch
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user