Spelling fixes (#12041)
* Spelling fixes *Lots* of them. * Spelling breaking changes * Fix lint errors
This commit is contained in:
1 parent
38fd9b65bf
commit
8dcfd35b8b
138 files changed
+285
-286
No files matched your search
@@ -736,7 +736,7 @@ class TestAutomationNumericState(unittest.TestCase):
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(0, len(self.calls))
|
||||
|
||||
def test_if_not_fires_on_entities_change_with_for_afte_stop(self):
|
||||
def test_if_not_fires_on_entities_change_with_for_after_stop(self):
|
||||
"""Test for not firing on entities change with for after stop."""
|
||||
assert setup_component(self.hass, automation.DOMAIN, {
|
||||
automation.DOMAIN: {
|
||||
|
||||
@@ -198,7 +198,7 @@ class TestAutomationState(unittest.TestCase):
|
||||
automation.DOMAIN: {
|
||||
'trigger': {
|
||||
'platform': 'state',
|
||||
'entity_id': 'test.anoter_entity',
|
||||
'entity_id': 'test.another_entity',
|
||||
},
|
||||
'action': {
|
||||
'service': 'test.automation'
|
||||
@@ -468,7 +468,7 @@ class TestAutomationState(unittest.TestCase):
|
||||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_if_fires_on_for_condition(self):
|
||||
"""Test for firing if contition is on."""
|
||||
"""Test for firing if condition is on."""
|
||||
point1 = dt_util.utcnow()
|
||||
point2 = point1 + timedelta(seconds=10)
|
||||
with patch('homeassistant.core.dt_util.utcnow') as mock_utcnow:
|
||||
@@ -504,7 +504,7 @@ class TestAutomationState(unittest.TestCase):
|
||||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_if_fires_on_for_condition_attribute_change(self):
|
||||
"""Test for firing if contition is on with attribute change."""
|
||||
"""Test for firing if condition is on with attribute change."""
|
||||
point1 = dt_util.utcnow()
|
||||
point2 = point1 + timedelta(seconds=4)
|
||||
point3 = point1 + timedelta(seconds=8)
|
||||
|
||||
@@ -127,7 +127,7 @@ class TestAutomationSun(unittest.TestCase):
|
||||
self.assertEqual('sun - sunset - 0:30:00', self.calls[0].data['some'])
|
||||
|
||||
def test_sunrise_trigger_with_offset(self):
|
||||
"""Test the runrise trigger with offset."""
|
||||
"""Test the sunrise trigger with offset."""
|
||||
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
|
||||
trigger_time = datetime(2015, 9, 16, 13, 30, tzinfo=dt_util.UTC)
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class TestVultrBinarySensorSetup(unittest.TestCase):
|
||||
|
||||
for device in self.DEVICES:
|
||||
|
||||
# Test pre data retieval
|
||||
# Test pre data retrieval
|
||||
if device.subscription == '555555':
|
||||
self.assertEqual('Vultr {}', device.name)
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ class TestTemplateCover(unittest.TestCase):
|
||||
assert self.hass.states.all() == []
|
||||
|
||||
def test_template_open_and_close(self):
|
||||
"""Test that if open_cover is specified, cose_cover is too."""
|
||||
"""Test that if open_cover is specified, close_cover is too."""
|
||||
with assert_setup_component(0, 'cover'):
|
||||
assert setup.setup_component(self.hass, 'cover', {
|
||||
'cover': {
|
||||
|
||||
@@ -378,7 +378,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
||||
telnet.login.assert_not_called()
|
||||
|
||||
def test_get_asuswrt_data(self):
|
||||
"""Test aususwrt data fetch."""
|
||||
"""Test asuswrt data fetch."""
|
||||
scanner = get_scanner(self.hass, VALID_CONFIG_ROUTER_SSH)
|
||||
scanner._get_wl = mock.Mock()
|
||||
scanner._get_arp = mock.Mock()
|
||||
|
||||
@@ -704,7 +704,7 @@ class TestComponentsDeviceTracker(unittest.TestCase):
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_async_added_to_hass(hass):
|
||||
"""Test resoring state."""
|
||||
"""Test restoring state."""
|
||||
attr = {
|
||||
device_tracker.ATTR_LONGITUDE: 18,
|
||||
device_tracker.ATTR_LATITUDE: -33,
|
||||
|
||||
@@ -56,7 +56,7 @@ class TestComponentsDeviceTrackerMQTT(unittest.TestCase):
|
||||
def test_new_message(self):
|
||||
"""Test new message."""
|
||||
dev_id = 'paulus'
|
||||
enttiy_id = device_tracker.ENTITY_ID_FORMAT.format(dev_id)
|
||||
entity_id = device_tracker.ENTITY_ID_FORMAT.format(dev_id)
|
||||
topic = '/location/paulus'
|
||||
location = 'work'
|
||||
|
||||
@@ -69,4 +69,4 @@ class TestComponentsDeviceTrackerMQTT(unittest.TestCase):
|
||||
})
|
||||
fire_mqtt_message(self.hass, topic, location)
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(location, self.hass.states.get(enttiy_id).state)
|
||||
self.assertEqual(location, self.hass.states.get(entity_id).state)
|
||||
@@ -433,7 +433,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
|
||||
def test_event_gps_entry_exit(self):
|
||||
"""Test the entry event."""
|
||||
# Entering the owntrack circular region named "inner"
|
||||
# Entering the owntracks circular region named "inner"
|
||||
self.send_message(EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE)
|
||||
|
||||
# Enter uses the zone's gps co-ords
|
||||
@@ -447,7 +447,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
# note that LOCATION_MESSAGE is actually pretty far
|
||||
# from INNER_ZONE and has good accuracy. I haven't
|
||||
# received a transition message though so I'm still
|
||||
# asssociated with the inner zone regardless of GPS.
|
||||
# associated with the inner zone regardless of GPS.
|
||||
self.assert_location_latitude(INNER_ZONE['latitude'])
|
||||
self.assert_location_accuracy(INNER_ZONE['radius'])
|
||||
self.assert_location_state('inner')
|
||||
@@ -624,7 +624,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
def test_event_entry_zone_loading_dash(self):
|
||||
"""Test the event for zone landing."""
|
||||
# Make sure the leading - is ignored
|
||||
# Ownracks uses this to switch on hold
|
||||
# Owntracks uses this to switch on hold
|
||||
message = build_message(
|
||||
{'desc': "-inner"},
|
||||
REGION_GPS_ENTER_MESSAGE)
|
||||
@@ -673,10 +673,10 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
|
||||
def test_event_source_type_entry_exit(self):
|
||||
"""Test the entry and exit events of source type."""
|
||||
# Entering the owntrack circular region named "inner"
|
||||
# Entering the owntracks circular region named "inner"
|
||||
self.send_message(EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE)
|
||||
|
||||
# source_type should be gps when enterings using gps.
|
||||
# source_type should be gps when entering using gps.
|
||||
self.assert_location_source_type('gps')
|
||||
|
||||
# owntracks shouldn't send beacon events with acc = 0
|
||||
@@ -715,7 +715,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
# note that LOCATION_MESSAGE is actually pretty far
|
||||
# from INNER_ZONE and has good accuracy. I haven't
|
||||
# received a transition message though so I'm still
|
||||
# asssociated with the inner zone regardless of GPS.
|
||||
# associated with the inner zone regardless of GPS.
|
||||
self.assert_location_latitude(INNER_ZONE['latitude'])
|
||||
self.assert_location_accuracy(INNER_ZONE['radius'])
|
||||
self.assert_location_state('inner')
|
||||
@@ -865,7 +865,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
|
||||
def test_event_beacon_entry_zone_loading_dash(self):
|
||||
"""Test the event for beacon zone landing."""
|
||||
# Make sure the leading - is ignored
|
||||
# Ownracks uses this to switch on hold
|
||||
# Owntracks uses this to switch on hold
|
||||
|
||||
message = build_message(
|
||||
{'desc': "-inner"},
|
||||
|
||||
@@ -218,7 +218,7 @@ def test_get_light_state(hass_hue, hue_client):
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_put_light_state(hass_hue, hue_client):
|
||||
"""Test the seeting of light states."""
|
||||
"""Test the setting of light states."""
|
||||
yield from perform_put_test_on_ceiling_lights(hass_hue, hue_client)
|
||||
|
||||
# Turn the bedroom light on first
|
||||
@@ -452,7 +452,7 @@ def perform_put_test_on_ceiling_lights(hass_hue, hue_client,
|
||||
|
||||
@asyncio.coroutine
|
||||
def perform_get_light_state(client, entity_id, expected_status):
|
||||
"""Test the gettting of a light state."""
|
||||
"""Test the getting of a light state."""
|
||||
result = yield from client.get('/api/username/lights/{}'.format(entity_id))
|
||||
|
||||
assert result.status == expected_status
|
||||
|
||||
@@ -1 +1 @@
|
||||
"""Test 'image_processing' component plaforms."""
|
||||
"""Test 'image_processing' component platforms."""
|
||||
@@ -275,7 +275,7 @@ class TestImageProcessingFace(object):
|
||||
@patch('homeassistant.components.image_processing.demo.'
|
||||
'DemoImageProcessingFace.confidence',
|
||||
new_callable=PropertyMock(return_value=None))
|
||||
def test_face_event_call_no_confidence(self, mock_confi, aioclient_mock):
|
||||
def test_face_event_call_no_confidence(self, mock_config, aioclient_mock):
|
||||
"""Setup and scan a picture and test faces from event."""
|
||||
aioclient_mock.get(self.url, content=b'image')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The tests for the openalpr clooud platform."""
|
||||
"""The tests for the openalpr cloud platform."""
|
||||
import asyncio
|
||||
from unittest.mock import patch, PropertyMock
|
||||
|
||||
@@ -13,7 +13,7 @@ from tests.common import (
|
||||
get_test_home_assistant, assert_setup_component, load_fixture)
|
||||
|
||||
|
||||
class TestOpenAlprCloudlSetup(object):
|
||||
class TestOpenAlprCloudSetup(object):
|
||||
"""Test class for image processing."""
|
||||
|
||||
def setup_method(self):
|
||||
|
||||
@@ -254,7 +254,7 @@ def test_signal_repetitions(hass, monkeypatch):
|
||||
|
||||
assert protocol.send_command_ack.call_count == 2
|
||||
|
||||
# test if default apply to configured devcies
|
||||
# test if default apply to configured devices
|
||||
hass.async_add_job(
|
||||
hass.services.async_call(DOMAIN, SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: DOMAIN + '.test1'}))
|
||||
|
||||
@@ -248,7 +248,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
||||
self.assertEqual(2, len(rfxtrx_core.RFX_DEVICES))
|
||||
|
||||
# trying to add a swicth
|
||||
# trying to add a switch
|
||||
event = rfxtrx_core.get_rfx_object('0b1100100118cdea02010f70')
|
||||
event.data = bytearray([0x0b, 0x11, 0x00, 0x10, 0x01, 0x18,
|
||||
0xcd, 0xea, 0x01, 0x01, 0x0f, 0x70])
|
||||
|
||||
@@ -208,7 +208,7 @@ def test_set_rgb_color(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB only
|
||||
# Supports RGB only
|
||||
color_channels = MockValue(data=0x1c, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -226,7 +226,7 @@ def test_set_rgbw_color(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGBW
|
||||
# Supports RGBW
|
||||
color_channels = MockValue(data=0x1d, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -245,7 +245,7 @@ def test_zw098_set_color_temp(mock_openzwave):
|
||||
command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB, warm white, cold white
|
||||
# Supports RGB, warm white, cold white
|
||||
color_channels = MockValue(data=0x1f, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -267,7 +267,7 @@ def test_rgb_not_supported(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts color temperature only
|
||||
# Supports color temperature only
|
||||
color_channels = MockValue(data=0x01, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -302,7 +302,7 @@ def test_rgb_value_changed(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB only
|
||||
# Supports RGB only
|
||||
color_channels = MockValue(data=0x1c, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -321,7 +321,7 @@ def test_rgbww_value_changed(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB, Warm White
|
||||
# Supports RGB, Warm White
|
||||
color_channels = MockValue(data=0x1d, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -340,7 +340,7 @@ def test_rgbcw_value_changed(mock_openzwave):
|
||||
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB, Cold White
|
||||
# Supports RGB, Cold White
|
||||
color_channels = MockValue(data=0x1e, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
@@ -360,7 +360,7 @@ def test_ct_value_changed(mock_openzwave):
|
||||
command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
|
||||
value = MockValue(data=0, node=node)
|
||||
color = MockValue(data='#0000000000', node=node)
|
||||
# Suppoorts RGB, Cold White
|
||||
# Supports RGB, Cold White
|
||||
color_channels = MockValue(data=0x1f, node=node)
|
||||
values = MockLightValues(primary=value, color=color,
|
||||
color_channels=color_channels)
|
||||
|
||||
@@ -158,7 +158,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
self.hass.stop()
|
||||
|
||||
@mock.patch('libsoundtouch.soundtouch_device', side_effect=None)
|
||||
def test_ensure_setup_config(self, mocked_sountouch_device):
|
||||
def test_ensure_setup_config(self, mocked_soundtouch_device):
|
||||
"""Test setup OK with custom config."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
@@ -167,10 +167,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
self.assertEqual(len(all_devices), 1)
|
||||
self.assertEqual(all_devices[0].name, 'soundtouch')
|
||||
self.assertEqual(all_devices[0].config['port'], 8090)
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
|
||||
@mock.patch('libsoundtouch.soundtouch_device', side_effect=None)
|
||||
def test_ensure_setup_discovery(self, mocked_sountouch_device):
|
||||
def test_ensure_setup_discovery(self, mocked_soundtouch_device):
|
||||
"""Test setup with discovery."""
|
||||
new_device = {"port": "8090",
|
||||
"host": "192.168.1.1",
|
||||
@@ -184,11 +184,11 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
self.assertEqual(len(all_devices), 1)
|
||||
self.assertEqual(all_devices[0].config['port'], 8090)
|
||||
self.assertEqual(all_devices[0].config['host'], '192.168.1.1')
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
|
||||
@mock.patch('libsoundtouch.soundtouch_device', side_effect=None)
|
||||
def test_ensure_setup_discovery_no_duplicate(self,
|
||||
mocked_sountouch_device):
|
||||
mocked_soundtouch_device):
|
||||
"""Test setup OK if device already exists."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
@@ -213,20 +213,20 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock(),
|
||||
existing_device # Existing device
|
||||
)
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 2)
|
||||
self.assertEqual(len(self.hass.data[soundtouch.DATA_SOUNDTOUCH]), 2)
|
||||
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.volume')
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_update(self, mocked_sountouch_device, mocked_status,
|
||||
def test_update(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test update device state."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.hass.data[soundtouch.DATA_SOUNDTOUCH][0].update()
|
||||
@@ -238,13 +238,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
side_effect=MockStatusPlaying)
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_playing_media(self, mocked_sountouch_device, mocked_status,
|
||||
def test_playing_media(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test playing media info."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -261,13 +261,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
side_effect=MockStatusUnknown)
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_playing_unknown_media(self, mocked_sountouch_device,
|
||||
def test_playing_unknown_media(self, mocked_soundtouch_device,
|
||||
mocked_status, mocked_volume):
|
||||
"""Test playing media info."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -278,13 +278,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
side_effect=MockStatusPlayingRadio)
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_playing_radio(self, mocked_sountouch_device, mocked_status,
|
||||
def test_playing_radio(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test playing radio info."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -301,13 +301,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_get_volume_level(self, mocked_sountouch_device, mocked_status,
|
||||
def test_get_volume_level(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test volume level."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -318,13 +318,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
side_effect=MockStatusStandby)
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_get_state_off(self, mocked_sountouch_device, mocked_status,
|
||||
def test_get_state_off(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test state device is off."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -335,13 +335,13 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
side_effect=MockStatusPause)
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_get_state_pause(self, mocked_sountouch_device, mocked_status,
|
||||
def test_get_state_pause(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test state device is paused."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
@@ -352,25 +352,25 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_is_muted(self, mocked_sountouch_device, mocked_status,
|
||||
def test_is_muted(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume):
|
||||
"""Test device volume is muted."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
self.assertEqual(all_devices[0].is_volume_muted, True)
|
||||
|
||||
@mock.patch('libsoundtouch.soundtouch_device')
|
||||
def test_media_commands(self, mocked_sountouch_device):
|
||||
def test_media_commands(self, mocked_soundtouch_device):
|
||||
"""Test supported media commands."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
self.assertEqual(all_devices[0].supported_features, 17853)
|
||||
|
||||
@@ -379,7 +379,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_should_turn_off(self, mocked_sountouch_device, mocked_status,
|
||||
def test_should_turn_off(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_power_off):
|
||||
"""Test device is turned off."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -387,7 +387,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].turn_off()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.assertEqual(mocked_power_off.call_count, 1)
|
||||
@@ -397,7 +397,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_should_turn_on(self, mocked_sountouch_device, mocked_status,
|
||||
def test_should_turn_on(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_power_on):
|
||||
"""Test device is turned on."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -405,7 +405,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].turn_on()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.assertEqual(mocked_power_on.call_count, 1)
|
||||
@@ -415,7 +415,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_volume_up(self, mocked_sountouch_device, mocked_status,
|
||||
def test_volume_up(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_volume_up):
|
||||
"""Test volume up."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -423,7 +423,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].volume_up()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
self.assertEqual(mocked_volume_up.call_count, 1)
|
||||
@@ -433,7 +433,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_volume_down(self, mocked_sountouch_device, mocked_status,
|
||||
def test_volume_down(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_volume_down):
|
||||
"""Test volume down."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -441,7 +441,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].volume_down()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
self.assertEqual(mocked_volume_down.call_count, 1)
|
||||
@@ -451,7 +451,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_set_volume_level(self, mocked_sountouch_device, mocked_status,
|
||||
def test_set_volume_level(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_set_volume):
|
||||
"""Test set volume level."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -459,7 +459,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].set_volume_level(0.17)
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
mocked_set_volume.assert_called_with(17)
|
||||
@@ -469,7 +469,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_mute(self, mocked_sountouch_device, mocked_status, mocked_volume,
|
||||
def test_mute(self, mocked_soundtouch_device, mocked_status, mocked_volume,
|
||||
mocked_mute):
|
||||
"""Test mute volume."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -477,7 +477,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].mute_volume(None)
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
self.assertEqual(mocked_mute.call_count, 1)
|
||||
@@ -487,7 +487,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_play(self, mocked_sountouch_device, mocked_status, mocked_volume,
|
||||
def test_play(self, mocked_soundtouch_device, mocked_status, mocked_volume,
|
||||
mocked_play):
|
||||
"""Test play command."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -495,7 +495,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].media_play()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.assertEqual(mocked_play.call_count, 1)
|
||||
@@ -505,15 +505,15 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_pause(self, mocked_sountouch_device, mocked_status, mocked_volume,
|
||||
mocked_pause):
|
||||
def test_pause(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_pause):
|
||||
"""Test pause command."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].media_pause()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.assertEqual(mocked_pause.call_count, 1)
|
||||
@@ -523,7 +523,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_play_pause_play(self, mocked_sountouch_device, mocked_status,
|
||||
def test_play_pause_play(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_play_pause):
|
||||
"""Test play/pause."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -531,7 +531,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].media_play_pause()
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
self.assertEqual(mocked_play_pause.call_count, 1)
|
||||
@@ -542,7 +542,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_next_previous_track(self, mocked_sountouch_device, mocked_status,
|
||||
def test_next_previous_track(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_next_track,
|
||||
mocked_previous_track):
|
||||
"""Test next/previous track."""
|
||||
@@ -550,7 +550,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices[0].media_next_track()
|
||||
@@ -567,14 +567,14 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_play_media(self, mocked_sountouch_device, mocked_status,
|
||||
def test_play_media(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_presets, mocked_select_preset):
|
||||
"""Test play preset 1."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices[0].play_media('PLAYLIST', 1)
|
||||
@@ -589,14 +589,14 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_play_media_url(self, mocked_sountouch_device, mocked_status,
|
||||
def test_play_media_url(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_play_url):
|
||||
"""Test play preset 1."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
default_component(),
|
||||
mock.MagicMock())
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 1)
|
||||
self.assertEqual(mocked_status.call_count, 1)
|
||||
self.assertEqual(mocked_volume.call_count, 1)
|
||||
all_devices[0].play_media('MUSIC', "http://fqdn/file.mp3")
|
||||
@@ -607,7 +607,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_play_everywhere(self, mocked_sountouch_device, mocked_status,
|
||||
def test_play_everywhere(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_create_zone):
|
||||
"""Test play everywhere."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -619,7 +619,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].entity_id = "media_player.entity_1"
|
||||
all_devices[1].entity_id = "media_player.entity_2"
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
|
||||
@@ -647,7 +647,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_create_zone(self, mocked_sountouch_device, mocked_status,
|
||||
def test_create_zone(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_create_zone):
|
||||
"""Test creating a zone."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -659,7 +659,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].entity_id = "media_player.entity_1"
|
||||
all_devices[1].entity_id = "media_player.entity_2"
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
|
||||
@@ -689,7 +689,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_remove_zone_slave(self, mocked_sountouch_device, mocked_status,
|
||||
def test_remove_zone_slave(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_remove_zone_slave):
|
||||
"""Test adding a slave to an existing zone."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -701,7 +701,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].entity_id = "media_player.entity_1"
|
||||
all_devices[1].entity_id = "media_player.entity_2"
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
|
||||
@@ -731,7 +731,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
@mock.patch('libsoundtouch.device.SoundTouchDevice.status')
|
||||
@mock.patch('libsoundtouch.soundtouch_device',
|
||||
side_effect=_mock_soundtouch_device)
|
||||
def test_add_zone_slave(self, mocked_sountouch_device, mocked_status,
|
||||
def test_add_zone_slave(self, mocked_soundtouch_device, mocked_status,
|
||||
mocked_volume, mocked_add_zone_slave):
|
||||
"""Test removing a slave from a zone."""
|
||||
soundtouch.setup_platform(self.hass,
|
||||
@@ -743,7 +743,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
|
||||
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
|
||||
all_devices[0].entity_id = "media_player.entity_1"
|
||||
all_devices[1].entity_id = "media_player.entity_2"
|
||||
self.assertEqual(mocked_sountouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_soundtouch_device.call_count, 2)
|
||||
self.assertEqual(mocked_status.call_count, 2)
|
||||
self.assertEqual(mocked_volume.call_count, 2)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import homeassistant.components.notify.facebook as facebook
|
||||
|
||||
|
||||
class TestFacebook(unittest.TestCase):
|
||||
"""Tests for Facebook notifification service."""
|
||||
"""Tests for Facebook notification service."""
|
||||
|
||||
def setUp(self):
|
||||
"""Set up test variables."""
|
||||
|
||||
@@ -110,7 +110,7 @@ class TestSensorMQTT(unittest.TestCase):
|
||||
self.assertEqual('unknown', state.state)
|
||||
|
||||
def test_setting_sensor_value_via_mqtt_json_message(self):
|
||||
"""Test the setting of the value via MQTT with JSON playload."""
|
||||
"""Test the setting of the value via MQTT with JSON payload."""
|
||||
mock_component(self.hass, 'mqtt')
|
||||
assert setup_component(self.hass, sensor.DOMAIN, {
|
||||
sensor.DOMAIN: {
|
||||
@@ -244,7 +244,7 @@ class TestSensorMQTT(unittest.TestCase):
|
||||
self.hass.bus.fire(ha.EVENT_TIME_CHANGED, {ha.ATTR_NOW: now})
|
||||
|
||||
def test_setting_sensor_attribute_via_mqtt_json_message(self):
|
||||
"""Test the setting of attribute via MQTT with JSON playload."""
|
||||
"""Test the setting of attribute via MQTT with JSON payload."""
|
||||
mock_component(self.hass, 'mqtt')
|
||||
assert setup_component(self.hass, sensor.DOMAIN, {
|
||||
sensor.DOMAIN: {
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestRandomSensor(unittest.TestCase):
|
||||
self.hass.stop()
|
||||
|
||||
def test_random_sensor(self):
|
||||
"""Test the Randowm number sensor."""
|
||||
"""Test the Random number sensor."""
|
||||
config = {
|
||||
'sensor': {
|
||||
'platform': 'random',
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestRingSensorSetup(unittest.TestCase):
|
||||
|
||||
@requests_mock.Mocker()
|
||||
def test_sensor(self, mock):
|
||||
"""Test the Ring senskor class and methods."""
|
||||
"""Test the Ring sensor class and methods."""
|
||||
mock.post('https://api.ring.com/clients_api/session',
|
||||
text=load_fixture('ring_session.json'))
|
||||
mock.get('https://api.ring.com/clients_api/ring_devices',
|
||||
|
||||
@@ -73,7 +73,7 @@ class TestSeason(unittest.TestCase):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
def test_season_should_be_summer_northern_astonomical(self):
|
||||
def test_season_should_be_summer_northern_astronomical(self):
|
||||
"""Test that season should be summer."""
|
||||
# A known day in summer
|
||||
summer_day = datetime(2017, 9, 3, 0, 0)
|
||||
@@ -91,7 +91,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_SUMMER,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_autumn_northern_astonomical(self):
|
||||
def test_season_should_be_autumn_northern_astronomical(self):
|
||||
"""Test that season should be autumn."""
|
||||
# A known day in autumn
|
||||
autumn_day = datetime(2017, 9, 23, 0, 0)
|
||||
@@ -109,7 +109,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_AUTUMN,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_winter_northern_astonomical(self):
|
||||
def test_season_should_be_winter_northern_astronomical(self):
|
||||
"""Test that season should be winter."""
|
||||
# A known day in winter
|
||||
winter_day = datetime(2017, 12, 25, 0, 0)
|
||||
@@ -127,7 +127,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_WINTER,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_spring_northern_astonomical(self):
|
||||
def test_season_should_be_spring_northern_astronomical(self):
|
||||
"""Test that season should be spring."""
|
||||
# A known day in spring
|
||||
spring_day = datetime(2017, 4, 1, 0, 0)
|
||||
@@ -145,7 +145,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_SPRING,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_winter_southern_astonomical(self):
|
||||
def test_season_should_be_winter_southern_astronomical(self):
|
||||
"""Test that season should be winter."""
|
||||
# A known day in winter
|
||||
winter_day = datetime(2017, 9, 3, 0, 0)
|
||||
@@ -163,7 +163,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_WINTER,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_spring_southern_astonomical(self):
|
||||
def test_season_should_be_spring_southern_astronomical(self):
|
||||
"""Test that season should be spring."""
|
||||
# A known day in spring
|
||||
spring_day = datetime(2017, 9, 23, 0, 0)
|
||||
@@ -181,7 +181,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_SPRING,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_summer_southern_astonomical(self):
|
||||
def test_season_should_be_summer_southern_astronomical(self):
|
||||
"""Test that season should be summer."""
|
||||
# A known day in summer
|
||||
summer_day = datetime(2017, 12, 25, 0, 0)
|
||||
@@ -199,7 +199,7 @@ class TestSeason(unittest.TestCase):
|
||||
self.assertEqual(season.STATE_SUMMER,
|
||||
current_season)
|
||||
|
||||
def test_season_should_be_autumn_southern_astonomical(self):
|
||||
def test_season_should_be_autumn_southern_astronomical(self):
|
||||
"""Test that season should be spring."""
|
||||
# A known day in spring
|
||||
autumn_day = datetime(2017, 4, 1, 0, 0)
|
||||
|
||||
@@ -107,7 +107,7 @@ class TestAlert(unittest.TestCase):
|
||||
self.assertEqual(STATE_ON, self.hass.states.get(ENTITY_ID).state)
|
||||
|
||||
def test_hidden(self):
|
||||
"""Test entity hidding."""
|
||||
"""Test entity hiding."""
|
||||
assert setup_component(self.hass, alert.DOMAIN, TEST_CONFIG)
|
||||
hidden = self.hass.states.get(ENTITY_ID).attributes.get('hidden')
|
||||
self.assertTrue(hidden)
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_setup_component_test_register_no_startup(hass):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_setup_component_test_servcie_start(hass):
|
||||
def test_setup_component_test_service_start(hass):
|
||||
"""Setup ffmpeg component test service start."""
|
||||
with assert_setup_component(2):
|
||||
yield from async_setup_component(
|
||||
@@ -113,7 +113,7 @@ def test_setup_component_test_servcie_start(hass):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_setup_component_test_servcie_stop(hass):
|
||||
def test_setup_component_test_service_stop(hass):
|
||||
"""Setup ffmpeg component test service stop."""
|
||||
with assert_setup_component(2):
|
||||
yield from async_setup_component(
|
||||
@@ -129,7 +129,7 @@ def test_setup_component_test_servcie_stop(hass):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_setup_component_test_servcie_restart(hass):
|
||||
def test_setup_component_test_service_restart(hass):
|
||||
"""Setup ffmpeg component test service restart."""
|
||||
with assert_setup_component(2):
|
||||
yield from async_setup_component(
|
||||
@@ -146,7 +146,7 @@ def test_setup_component_test_servcie_restart(hass):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_setup_component_test_servcie_start_with_entity(hass):
|
||||
def test_setup_component_test_service_start_with_entity(hass):
|
||||
"""Setup ffmpeg component test service start."""
|
||||
with assert_setup_component(2):
|
||||
yield from async_setup_component(
|
||||
|
||||
@@ -211,7 +211,7 @@ def test_setup_hassio_no_additional_data(hass, aioclient_mock):
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_service_register(hassio_env, hass):
|
||||
"""Check if service will be settup."""
|
||||
"""Check if service will be setup."""
|
||||
assert (yield from async_setup_component(hass, 'hassio', {}))
|
||||
assert hass.services.has_service('hassio', 'addon_start')
|
||||
assert hass.services.has_service('hassio', 'addon_stop')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The testd for Core components."""
|
||||
"""The tests for Core components."""
|
||||
# pylint: disable=protected-access
|
||||
import asyncio
|
||||
import unittest
|
||||
|
||||
@@ -304,7 +304,7 @@ class TestPilight(unittest.TestCase):
|
||||
with assert_setup_component(4):
|
||||
whitelist = {
|
||||
'protocol': [PilightDaemonSim.test_message['protocol'],
|
||||
'other_protocoll'],
|
||||
'other_protocol'],
|
||||
'id': [PilightDaemonSim.test_message['message']['id']]}
|
||||
self.assertTrue(setup_component(
|
||||
self.hass, pilight.DOMAIN,
|
||||
@@ -330,7 +330,7 @@ class TestPilight(unittest.TestCase):
|
||||
"""Check whitelist filter with unmatched data, should not work."""
|
||||
with assert_setup_component(4):
|
||||
whitelist = {
|
||||
'protocol': ['wrong_protocoll'],
|
||||
'protocol': ['wrong_protocol'],
|
||||
'id': [PilightDaemonSim.test_message['message']['id']]}
|
||||
self.assertTrue(setup_component(
|
||||
self.hass, pilight.DOMAIN,
|
||||
|
||||
@@ -105,7 +105,7 @@ class TestPlant(unittest.TestCase):
|
||||
self.assertEqual(5, state.attributes[plant.READING_MOISTURE])
|
||||
|
||||
@pytest.mark.skipif(plant.ENABLE_LOAD_HISTORY is False,
|
||||
reason="tests for loading from DB are instable, thus"
|
||||
reason="tests for loading from DB are unstable, thus"
|
||||
"this feature is turned of until tests become"
|
||||
"stable")
|
||||
def test_load_from_db(self):
|
||||
|
||||
@@ -54,7 +54,7 @@ class TestConfiguration(unittest.TestCase):
|
||||
def test_invalid_data(self):
|
||||
"""Test starts with invalid data and should not raise an exception."""
|
||||
with patch("builtins.open",
|
||||
mock_open(read_data='random charachters')),\
|
||||
mock_open(read_data='random characters')),\
|
||||
patch("os.path.isfile", Mock(return_value=True)):
|
||||
config = rtm.RememberTheMilkConfiguration(self.hass)
|
||||
self.assertIsNotNone(config)
|
||||
|
||||
@@ -47,7 +47,7 @@ def mock_rflink(hass, config, domain, monkeypatch, failures=None,
|
||||
'rflink.protocol.create_rflink_connection',
|
||||
mock_create)
|
||||
|
||||
# verify instanstiation of component with given config
|
||||
# verify instantiation of component with given config
|
||||
with assert_setup_component(platform_count, domain):
|
||||
yield from async_setup_component(hass, domain, config)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def mock_http_client(loop, hass, test_client):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_get_noexistant_feed(mock_http_client):
|
||||
def test_get_nonexistant_feed(mock_http_client):
|
||||
"""Test if we can retrieve the correct rss feed."""
|
||||
resp = yield from mock_http_client.get('/api/rss_template/otherfeed')
|
||||
assert resp.status == 404
|
||||
|
||||
@@ -899,7 +899,7 @@ class TestZWaveServices(unittest.TestCase):
|
||||
assert value.label == "New Label"
|
||||
|
||||
def test_set_poll_intensity_enable(self):
|
||||
"""Test zwave set_poll_intensity service, succsessful set."""
|
||||
"""Test zwave set_poll_intensity service, successful set."""
|
||||
node = MockNode(node_id=14)
|
||||
value = MockValue(index=12, value_id=123456, poll_intensity=0)
|
||||
node.values = {123456: value}
|
||||
|
||||
Reference in new issue
Block a user