Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods * Remove globally disabled pylint warnings
This commit is contained in:
1 parent
b910a9917d
commit
be272ac64a
298 files changed
+271
-570
No files matched your search
+11
-9
@@ -1,5 +1,5 @@
|
||||
"""Test Home Assistant remote methods and classes."""
|
||||
# pylint: disable=protected-access,too-many-public-methods
|
||||
# pylint: disable=protected-access
|
||||
import asyncio
|
||||
import threading
|
||||
import time
|
||||
@@ -16,11 +16,11 @@ import homeassistant.util.dt as dt_util
|
||||
from tests.common import (
|
||||
get_test_instance_port, get_test_home_assistant, get_test_config_dir)
|
||||
|
||||
API_PASSWORD = "test1234"
|
||||
API_PASSWORD = 'test1234'
|
||||
MASTER_PORT = get_test_instance_port()
|
||||
SLAVE_PORT = get_test_instance_port()
|
||||
BROKEN_PORT = get_test_instance_port()
|
||||
HTTP_BASE_URL = "http://127.0.0.1:{}".format(MASTER_PORT)
|
||||
HTTP_BASE_URL = 'http://127.0.0.1:{}'.format(MASTER_PORT)
|
||||
|
||||
HA_HEADERS = {HTTP_HEADER_HA_AUTH: API_PASSWORD}
|
||||
|
||||
@@ -28,12 +28,13 @@ broken_api = remote.API('127.0.0.1', "bladiebla")
|
||||
hass, slave, master_api = None, None, None
|
||||
|
||||
|
||||
def _url(path=""):
|
||||
def _url(path=''):
|
||||
"""Helper method to generate URLs."""
|
||||
return HTTP_BASE_URL + path
|
||||
|
||||
|
||||
def setUpModule(): # pylint: disable=invalid-name
|
||||
# pylint: disable=invalid-name
|
||||
def setUpModule():
|
||||
"""Initalization of a Home Assistant server and Slave instance."""
|
||||
global hass, slave, master_api
|
||||
|
||||
@@ -52,13 +53,13 @@ def setUpModule(): # pylint: disable=invalid-name
|
||||
hass.start()
|
||||
time.sleep(0.05)
|
||||
|
||||
master_api = remote.API("127.0.0.1", API_PASSWORD, MASTER_PORT)
|
||||
master_api = remote.API('127.0.0.1', API_PASSWORD, MASTER_PORT)
|
||||
|
||||
# Start slave
|
||||
loop = asyncio.new_event_loop()
|
||||
|
||||
# FIXME: should not be a daemon
|
||||
threading.Thread(name="SlaveThread", daemon=True,
|
||||
threading.Thread(name='SlaveThread', daemon=True,
|
||||
target=loop.run_forever).start()
|
||||
|
||||
slave = remote.HomeAssistant(master_api, loop=loop)
|
||||
@@ -73,7 +74,8 @@ def setUpModule(): # pylint: disable=invalid-name
|
||||
slave.start()
|
||||
|
||||
|
||||
def tearDownModule(): # pylint: disable=invalid-name
|
||||
# pylint: disable=invalid-name
|
||||
def tearDownModule():
|
||||
"""Stop the Home Assistant server and slave."""
|
||||
slave.stop()
|
||||
hass.stop()
|
||||
@@ -94,7 +96,7 @@ class TestRemoteMethods(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
remote.APIStatus.INVALID_PASSWORD,
|
||||
remote.validate_api(
|
||||
remote.API("127.0.0.1", API_PASSWORD + "A", MASTER_PORT)))
|
||||
remote.API('127.0.0.1', API_PASSWORD + 'A', MASTER_PORT)))
|
||||
|
||||
self.assertEqual(
|
||||
remote.APIStatus.CANNOT_CONNECT, remote.validate_api(broken_api))
|
||||
|
||||
Reference in new issue
Block a user