Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ omit =
homeassistant/components/google.py
homeassistant/components/*/google.py

homeassistant/components/insteon_hub.py
homeassistant/components/*/insteon_hub.py

homeassistant/components/insteon_local.py
homeassistant/components/*/insteon_local.py

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/calendar/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices, disc_info=None):
if disc_info is None:
return

if not any([data[CONF_TRACK] for data in disc_info[CONF_ENTITIES]]):
if not any(data[CONF_TRACK] for data in disc_info[CONF_ENTITIES]):
return

calendar_service = GoogleCalendarService(hass.config.path(TOKEN_FILE))
Expand Down
55 changes: 0 additions & 55 deletions homeassistant/components/insteon_hub.py

This file was deleted.

79 changes: 0 additions & 79 deletions homeassistant/components/light/insteon_hub.py

This file was deleted.

2 changes: 1 addition & 1 deletion homeassistant/components/tellduslive.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def discover(device_id, component):
discovery.load_platform(
self._hass, component, DOMAIN, [device_id], self._config)

known_ids = set([entity.device_id for entity in self.entities])
known_ids = {entity.device_id for entity in self.entities}
for device in self._client.devices:
if device.device_id in known_ids:
continue
Expand Down
3 changes: 0 additions & 3 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ https://github.com/wokar/pylgnetcast/archive/v0.2.0.zip#pylgnetcast==0.2.0
# homeassistant.components.sensor.influxdb
influxdb==3.0.0

# homeassistant.components.insteon_hub
insteon_hub==0.4.5

# homeassistant.components.insteon_local
insteonlocal==0.52

Expand Down
35 changes: 18 additions & 17 deletions tests/components/device_tracker/test_owntracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import asyncio
import json
import os
import unittest
from collections import defaultdict
import unittest
from unittest.mock import patch

from tests.common import (assert_setup_component, fire_mqtt_message,
Expand Down Expand Up @@ -187,9 +187,9 @@
BAD_JSON_PREFIX = '--$this is bad json#--'
BAD_JSON_SUFFIX = '** and it ends here ^^'

SECRET_KEY = 's3cretkey'
TEST_SECRET_KEY = 's3cretkey'
ENCRYPTED_LOCATION_MESSAGE = {
# Encrypted version of LOCATION_MESSAGE using libsodium and SECRET_KEY
# Encrypted version of LOCATION_MESSAGE using libsodium and TEST_SECRET_KEY
'_type': 'encrypted',
'data': ('qm1A83I6TVFRmH5343xy+cbex8jBBxDFkHRuJhELVKVRA/DgXcyKtghw'
'9pOw75Lo4gHcyy2wV5CmkjrpKEBR7Qhye4AR0y7hOvlx6U/a3GuY1+W8'
Expand Down Expand Up @@ -685,6 +685,18 @@ def test_waypoint_import_existing(self):
self.assertTrue(wayp == new_wayp)


def mock_cipher():
"""Return a dummy pickle-based cipher."""
def mock_decrypt(ciphertext, key):
"""Decrypt/unpickle."""
import pickle
(mkey, plaintext) = pickle.loads(ciphertext)
if key != mkey:
raise ValueError()
return plaintext
return (len(TEST_SECRET_KEY), mock_decrypt)


class TestDeviceTrackerOwnTrackConfigs(BaseMQTT):
"""Test the OwnTrack sensor."""

Expand All @@ -699,17 +711,6 @@ def teardown_method(self, method):
"""Tear down resources."""
self.hass.stop()

def mock_cipher(): # pylint: disable=no-method-argument
"""Return a dummy pickle-based cipher."""
def mock_decrypt(ciphertext, key):
"""Decrypt/unpickle."""
import pickle
(mkey, plaintext) = pickle.loads(ciphertext)
if key != mkey:
raise ValueError()
return plaintext
return (len(SECRET_KEY), mock_decrypt)

@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
mock_cipher)
def test_encrypted_payload(self):
Expand All @@ -718,7 +719,7 @@ def test_encrypted_payload(self):
assert setup_component(self.hass, device_tracker.DOMAIN, {
device_tracker.DOMAIN: {
CONF_PLATFORM: 'owntracks',
CONF_SECRET: SECRET_KEY,
CONF_SECRET: TEST_SECRET_KEY,
}})
self.send_message(LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE)
self.assert_location_latitude(2.0)
Expand All @@ -732,7 +733,7 @@ def test_encrypted_payload_topic_key(self):
device_tracker.DOMAIN: {
CONF_PLATFORM: 'owntracks',
CONF_SECRET: {
LOCATION_TOPIC: SECRET_KEY,
LOCATION_TOPIC: TEST_SECRET_KEY,
}}})
self.send_message(LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE)
self.assert_location_latitude(2.0)
Expand Down Expand Up @@ -803,7 +804,7 @@ def test_encrypted_payload_libsodium(self):
assert setup_component(self.hass, device_tracker.DOMAIN, {
device_tracker.DOMAIN: {
CONF_PLATFORM: 'owntracks',
CONF_SECRET: SECRET_KEY,
CONF_SECRET: TEST_SECRET_KEY,
}})

self.send_message(LOCATION_TOPIC, ENCRYPTED_LOCATION_MESSAGE)
Expand Down