Make names command line platform consistent

This commit is contained in:
Paulus Schoutsen 2016-02-27 15:56:35 -08:00
parent afb51d14b8
commit be55ee059e
8 changed files with 27 additions and 27 deletions

View File

@ -9,7 +9,7 @@ import logging
from datetime import timedelta from datetime import timedelta
from homeassistant.components.binary_sensor import BinarySensorDevice 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.const import CONF_VALUE_TEMPLATE
from homeassistant.helpers import template from homeassistant.helpers import template

View File

@ -1,5 +1,5 @@
""" """
tests.components.binary_sensor.command_sensor tests.components.binary_sensor.command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests command binary sensor. Tests command binary sensor.
@ -7,7 +7,7 @@ Tests command binary sensor.
import unittest import unittest
from homeassistant.const import (STATE_ON, STATE_OFF) 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 from tests.common import get_test_home_assistant
@ -35,7 +35,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
for dev in devs: for dev in devs:
devices.append(dev) devices.append(dev)
command_sensor.setup_platform( command_line.setup_platform(
self.hass, config, add_dev_callback) self.hass, config, add_dev_callback)
self.assertEqual(1, len(devices)) self.assertEqual(1, len(devices))
@ -54,25 +54,25 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
for dev in devs: for dev in devs:
devices.append(dev) devices.append(dev)
self.assertFalse(command_sensor.setup_platform( self.assertFalse(command_line.setup_platform(
self.hass, config, add_dev_callback)) self.hass, config, add_dev_callback))
self.assertEqual(0, len(devices)) self.assertEqual(0, len(devices))
def test_template(self): def test_template(self):
""" Test command sensor with template """ """ 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.hass, data, 'test', '1.0', '0', '{{ value | multiply(0.1) }}')
self.assertEqual(STATE_ON, entity.state) self.assertEqual(STATE_ON, entity.state)
def test_sensor_off(self): def test_sensor_off(self):
""" Test command sensor with template """ """ 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.hass, data, 'test', '1', '0', None)
self.assertEqual(STATE_OFF, entity.state) self.assertEqual(STATE_OFF, entity.state)

View File

@ -1,7 +1,7 @@
""" """
tests.components.rollershutter.command_rollershutter tests.components.rollershutter.command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the command_rollershutter component Tests the command_line component
""" """
import os import os
@ -12,7 +12,7 @@ from unittest import mock
import homeassistant.core as ha import homeassistant.core as ha
import homeassistant.components.rollershutter as rollershutter import homeassistant.components.rollershutter as rollershutter
from homeassistant.components.rollershutter import ( from homeassistant.components.rollershutter import (
command_rollershutter as cmd_rs) command_line as cmd_rs)
class TestCommandRollerShutter(unittest.TestCase): class TestCommandRollerShutter(unittest.TestCase):
@ -53,7 +53,7 @@ class TestCommandRollerShutter(unittest.TestCase):
} }
self.assertTrue(rollershutter.setup(self.hass, { self.assertTrue(rollershutter.setup(self.hass, {
'rollershutter': { 'rollershutter': {
'platform': 'command_rollershutter', 'platform': 'command_line',
'rollershutters': { 'rollershutters': {
'test': test_rollershutter 'test': test_rollershutter
} }

View File

@ -1,12 +1,12 @@
""" """
tests.components.sensor.test_command_sensor tests.components.sensor.test_command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests command sensor. Tests command sensor.
""" """
import unittest import unittest
from homeassistant.components.sensor import command_sensor from homeassistant.components.sensor import command_line
from tests.common import get_test_home_assistant from tests.common import get_test_home_assistant
@ -33,7 +33,7 @@ class TestCommandSensorSensor(unittest.TestCase):
for dev in devs: for dev in devs:
devices.append(dev) devices.append(dev)
command_sensor.setup_platform( command_line.setup_platform(
self.hass, config, add_dev_callback) self.hass, config, add_dev_callback)
self.assertEqual(1, len(devices)) self.assertEqual(1, len(devices))
@ -53,23 +53,23 @@ class TestCommandSensorSensor(unittest.TestCase):
for dev in devs: for dev in devs:
devices.append(dev) devices.append(dev)
self.assertFalse(command_sensor.setup_platform( self.assertFalse(command_line.setup_platform(
self.hass, config, add_dev_callback)) self.hass, config, add_dev_callback))
self.assertEqual(0, len(devices)) self.assertEqual(0, len(devices))
def test_template(self): def test_template(self):
""" Test command sensor with template. """ """ 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.hass, data, 'test', 'in', '{{ value | multiply(0.1) }}')
self.assertEqual(5, float(entity.state)) self.assertEqual(5, float(entity.state))
def test_bad_command(self): def test_bad_command(self):
""" Test bad command. """ """ Test bad command. """
data = command_sensor.CommandSensorData('asdfasdf') data = command_line.CommandSensorData('asdfasdf')
data.update() data.update()
self.assertEqual(None, data.value) self.assertEqual(None, data.value)

View File

@ -1,6 +1,6 @@
""" """
tests.components.switch.test_command_switch tests.components.switch.test_command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests command switch. Tests command switch.
""" """
@ -34,7 +34,7 @@ class TestCommandSwitch(unittest.TestCase):
} }
self.assertTrue(switch.setup(self.hass, { self.assertTrue(switch.setup(self.hass, {
'switch': { 'switch': {
'platform': 'command_switch', 'platform': 'command_line',
'switches': { 'switches': {
'test': test_switch 'test': test_switch
} }
@ -67,7 +67,7 @@ class TestCommandSwitch(unittest.TestCase):
} }
self.assertTrue(switch.setup(self.hass, { self.assertTrue(switch.setup(self.hass, {
'switch': { 'switch': {
'platform': 'command_switch', 'platform': 'command_line',
'switches': { 'switches': {
'test': test_switch 'test': test_switch
} }
@ -102,7 +102,7 @@ class TestCommandSwitch(unittest.TestCase):
} }
self.assertTrue(switch.setup(self.hass, { self.assertTrue(switch.setup(self.hass, {
'switch': { 'switch': {
'platform': 'command_switch', 'platform': 'command_line',
'switches': { 'switches': {
'test': test_switch 'test': test_switch
} }
@ -134,7 +134,7 @@ class TestCommandSwitch(unittest.TestCase):
} }
self.assertTrue(switch.setup(self.hass, { self.assertTrue(switch.setup(self.hass, {
'switch': { 'switch': {
'platform': 'command_switch', 'platform': 'command_line',
'switches': { 'switches': {
'test': test_switch 'test': test_switch
} }