Grammar and spelling fixes (#16065)

This commit is contained in:
Ville Skyttä authored and Fabian Affolter committed 2018-08-19 22:29:08 +02:00
1 parent 9e1fa7ef42
commit dbd0763f83
244 files changed
+453 -453

No files matched your search

@@ -22,7 +22,7 @@ class TestAlarmControlPanelManual(unittest.TestCase):
"""Test the manual alarm module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
@@ -21,7 +21,7 @@ class TestAlarmControlPanelManualMqtt(unittest.TestCase):
"""Test the manual_mqtt alarm module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
@@ -21,7 +21,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -18,7 +18,7 @@ BASE_CONFIG = [{
async def async_setup_auth(hass, aiohttp_client, provider_configs=BASE_CONFIG,
setup_api=False):
"""Helper to setup authentication and create a HTTP client."""
"""Helper to set up authentication and create an HTTP client."""
hass.auth = await auth.auth_manager_from_config(hass, provider_configs)
ensure_auth_manager_loaded(hass.auth)
await async_setup_component(hass, 'auth', {
+1 -1
View File
@@ -13,7 +13,7 @@ class TestAutomationEvent(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
self.calls = []
+1 -1
View File
@@ -22,7 +22,7 @@ class TestAutomation(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.calls = mock_service(self.hass, 'test', 'automation')
+1 -1
View File
@@ -23,7 +23,7 @@ class TestLiteJetTrigger(unittest.TestCase):
@mock.patch('pylitejet.LiteJet')
def setup_method(self, method, mock_pylitejet):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.start()
+1 -1
View File
@@ -14,7 +14,7 @@ class TestAutomationMQTT(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
mock_mqtt_component(self.hass)
@@ -18,7 +18,7 @@ class TestAutomationNumericState(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
self.calls = []
+1 -1
View File
@@ -19,7 +19,7 @@ class TestAutomationState(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
self.hass.states.set('test.entity', 'hello')
+1 -1
View File
@@ -19,7 +19,7 @@ class TestAutomationSun(unittest.TestCase):
"""Test the sun automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
setup_component(self.hass, sun.DOMAIN, {
+1 -1
View File
@@ -14,7 +14,7 @@ class TestAutomationTemplate(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
self.hass.states.set('test.entity', 'hello')
+1 -1
View File
@@ -18,7 +18,7 @@ class TestAutomationTime(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
self.calls = []
+1 -1
View File
@@ -13,7 +13,7 @@ class TestAutomationZone(unittest.TestCase):
"""Test the event automation."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'group')
assert setup_component(self.hass, zone.DOMAIN, {
@@ -12,7 +12,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
"""Test the Command line Binary sensor."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -11,7 +11,7 @@ class TestFFmpegNoiseSetup:
"""Test class for ffmpeg."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.config = {
@@ -29,7 +29,7 @@ class TestFFmpegNoiseSetup:
self.hass.stop()
def test_setup_component(self):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
@@ -38,7 +38,7 @@ class TestFFmpegNoiseSetup:
@patch('haffmpeg.SensorNoise.open_sensor', return_value=mock_coro())
def test_setup_component_start(self, mock_start):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
@@ -53,7 +53,7 @@ class TestFFmpegNoiseSetup:
@patch('haffmpeg.SensorNoise')
def test_setup_component_start_callback(self, mock_ffmpeg):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
@@ -76,7 +76,7 @@ class TestFFmpegMotionSetup:
"""Test class for ffmpeg."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.config = {
@@ -94,7 +94,7 @@ class TestFFmpegMotionSetup:
self.hass.stop()
def test_setup_component(self):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
@@ -103,7 +103,7 @@ class TestFFmpegMotionSetup:
@patch('haffmpeg.SensorMotion.open_sensor', return_value=mock_coro())
def test_setup_component_start(self, mock_start):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
@@ -118,7 +118,7 @@ class TestFFmpegMotionSetup:
@patch('haffmpeg.SensorMotion')
def test_setup_component_start_callback(self, mock_ffmpeg):
"""Setup ffmpeg component."""
"""Set up ffmpeg component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor', self.config)
+1 -1
View File
@@ -16,7 +16,7 @@ class TestSensorMQTT(unittest.TestCase):
"""Test the MQTT sensor."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
+1 -1
View File
@@ -21,7 +21,7 @@ class TestNX584SensorSetup(unittest.TestCase):
"""Test the NX584 sensor platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self._mock_client = mock.patch.object(nx584_client, 'Client')
self._mock_client.start()
+2 -2
View File
@@ -19,7 +19,7 @@ class TestRestBinarySensorSetup(unittest.TestCase):
"""Tests for setting up the REST binary sensor platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -121,7 +121,7 @@ class TestRestBinarySensor(unittest.TestCase):
"""Tests for REST binary sensor platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.rest = Mock('RestData')
self.rest.update = Mock('RestData.update',
+1 -1
View File
@@ -13,7 +13,7 @@ class TestTCPBinarySensor(unittest.TestCase):
"""Test the TCP Binary Sensor."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
@@ -23,7 +23,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
# pylint: disable=invalid-name
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
@@ -16,7 +16,7 @@ class TestWorkdaySetup:
"""Test class for workday sensor."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
# Set valid default config for test
@@ -97,7 +97,7 @@ class TestWorkdaySetup:
self.hass.stop()
def test_setup_component_province(self):
"""Setup workday component."""
"""Set up workday component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor',
self.config_province)
@@ -145,7 +145,7 @@ class TestWorkdaySetup:
assert entity.state == 'off'
def test_setup_component_noprovince(self):
"""Setup workday component."""
"""Set up workday component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor',
self.config_noprovince)
@@ -191,7 +191,7 @@ class TestWorkdaySetup:
assert entity.state == 'on'
def test_setup_component_invalidprovince(self):
"""Setup workday component."""
"""Set up workday component."""
with assert_setup_component(1, 'binary_sensor'):
setup_component(self.hass, 'binary_sensor',
self.config_invalidprovince)
+1 -1
View File
@@ -25,7 +25,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.http = Mock()
+3 -3
View File
@@ -34,7 +34,7 @@ class TestSetupCamera:
"""Test class for setup camera."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -42,7 +42,7 @@ class TestSetupCamera:
self.hass.stop()
def test_setup_component(self):
"""Setup demo platform on camera component."""
"""Set up demo platform on camera component."""
config = {
camera.DOMAIN: {
'platform': 'demo'
@@ -57,7 +57,7 @@ class TestGetImage:
"""Test class for camera."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
setup_component(
+4 -4
View File
@@ -17,7 +17,7 @@ class TestUVCSetup(unittest.TestCase):
"""Test the UVC camera platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -134,7 +134,7 @@ class TestUVCSetup(unittest.TestCase):
@mock.patch.object(uvc, 'UnifiVideoCamera')
@mock.patch('uvcclient.nvr.UVCRemote')
def setup_nvr_errors_during_indexing(self, error, mock_remote, mock_uvc):
"""Setup test for NVR errors during indexing."""
"""Set up test for NVR errors during indexing."""
config = {
'platform': 'uvc',
'nvr': 'foo',
@@ -163,7 +163,7 @@ class TestUVCSetup(unittest.TestCase):
@mock.patch('uvcclient.nvr.UVCRemote.__init__')
def setup_nvr_errors_during_initialization(self, error, mock_remote,
mock_uvc):
"""Setup test for NVR errors during initialization."""
"""Set up test for NVR errors during initialization."""
config = {
'platform': 'uvc',
'nvr': 'foo',
@@ -195,7 +195,7 @@ class TestUVC(unittest.TestCase):
"""Test class for UVC."""
def setup_method(self, method):
"""Setup the mock camera."""
"""Set up the mock camera."""
self.nvr = mock.MagicMock()
self.uuid = 'uuid'
self.name = 'name'
+1 -1
View File
@@ -19,7 +19,7 @@ class TestDemoClimate(unittest.TestCase):
"""Test the demo climate hvac."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.units = METRIC_SYSTEM
self.assertTrue(setup_component(self.hass, climate.DOMAIN, {
@@ -42,7 +42,7 @@ class TestSetupClimateGenericThermostat(unittest.TestCase):
"""Test the Generic thermostat with custom config."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
@@ -79,7 +79,7 @@ class TestGenericThermostatHeaterSwitching(unittest.TestCase):
"""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.units = METRIC_SYSTEM
self.assertTrue(run_coroutine_threadsafe(
@@ -142,7 +142,7 @@ class TestGenericThermostatHeaterSwitching(unittest.TestCase):
self.hass.states.get(heater_switch).state)
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
@@ -152,7 +152,7 @@ class TestClimateGenericThermostat(unittest.TestCase):
"""Test the Generic thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.units = METRIC_SYSTEM
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -368,13 +368,13 @@ class TestClimateGenericThermostat(unittest.TestCase):
self.assertEqual(ENT_SWITCH, call.data['entity_id'])
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -391,7 +391,7 @@ class TestClimateGenericThermostatACMode(unittest.TestCase):
"""Test the Generic thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -533,13 +533,13 @@ class TestClimateGenericThermostatACMode(unittest.TestCase):
self.assertEqual(0, len(self.calls))
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -556,7 +556,7 @@ class TestClimateGenericThermostatACModeMinCycle(unittest.TestCase):
"""Test the Generic Thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -627,13 +627,13 @@ class TestClimateGenericThermostatACModeMinCycle(unittest.TestCase):
self.assertEqual(ENT_SWITCH, call.data['entity_id'])
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -650,7 +650,7 @@ class TestClimateGenericThermostatMinCycle(unittest.TestCase):
"""Test the Generic thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -720,13 +720,13 @@ class TestClimateGenericThermostatMinCycle(unittest.TestCase):
self.assertEqual(ENT_SWITCH, call.data['entity_id'])
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -743,7 +743,7 @@ class TestClimateGenericThermostatACKeepAlive(unittest.TestCase):
"""Test the Generic Thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -813,13 +813,13 @@ class TestClimateGenericThermostatACKeepAlive(unittest.TestCase):
self.hass.bus.fire(ha.EVENT_TIME_CHANGED, {ha.ATTR_NOW: now})
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -836,7 +836,7 @@ class TestClimateGenericThermostatKeepAlive(unittest.TestCase):
"""Test the Generic Thermostat."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
assert setup_component(self.hass, climate.DOMAIN, {'climate': {
@@ -905,13 +905,13 @@ class TestClimateGenericThermostatKeepAlive(unittest.TestCase):
self.hass.bus.fire(ha.EVENT_TIME_CHANGED, {ha.ATTR_NOW: now})
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
@@ -999,7 +999,7 @@ class TestClimateGenericThermostatRestoreState(unittest.TestCase):
"""Test generic thermostat when restore state from HA startup."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.config.temperature_unit = TEMP_CELSIUS
@@ -1048,13 +1048,13 @@ class TestClimateGenericThermostatRestoreState(unittest.TestCase):
}})
def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
"""Setup the test sensor."""
"""Set up the test sensor."""
self.hass.states.set(ENT_SENSOR, temp, {
ATTR_UNIT_OF_MEASUREMENT: unit
})
def _setup_switch(self, is_on):
"""Setup the test switch."""
"""Set up the test switch."""
self.hass.states.set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
self.calls = []
+1 -1
View File
@@ -35,7 +35,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test the mqtt climate hvac."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
self.hass.config.units = METRIC_SYSTEM
+1 -1
View File
@@ -17,7 +17,7 @@ class TestCommandCover(unittest.TestCase):
"""Test the cover command line platform."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.rs = cmd_rs.CommandCover(self.hass, 'foo',
'command_open', 'command_close',
+1 -1
View File
@@ -14,7 +14,7 @@ class TestCoverDemo(unittest.TestCase):
"""Test the Demo cover."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.assertTrue(setup_component(self.hass, cover.DOMAIN, {'cover': {
'platform': 'demo',
+1 -1
View File
@@ -35,7 +35,7 @@ class TestMultiCover(unittest.TestCase):
"""Test the group cover platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
+1 -1
View File
@@ -15,7 +15,7 @@ class TestCoverMQTT(unittest.TestCase):
"""Test the MQTT cover."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -14,7 +14,7 @@ class TestCoverRfxtrx(unittest.TestCase):
"""Test the Rfxtrx cover platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component('rfxtrx')
@@ -116,7 +116,7 @@ WAKE_DEVICES_NO_IP = {
def setup_module():
"""Setup the test module."""
"""Set up the test module."""
global FAKEFILE
FAKEFILE = get_test_config_dir('fake_file')
with open(FAKEFILE, 'w') as out:
@@ -138,7 +138,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
hass = None
def setup_method(self, _):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'zone')
@@ -500,7 +500,7 @@ class TestSshConnection(unittest.TestCase):
"""Testing SshConnection."""
def setUp(self):
"""Setup test env."""
"""Set up test env."""
self.connection = SshConnection(
'fake', 'fake', 'fake', 'fake', 'fake')
self.connection._connected = True
@@ -544,7 +544,7 @@ class TestTelnetConnection(unittest.TestCase):
"""Testing TelnetConnection."""
def setUp(self):
"""Setup test env."""
"""Set up test env."""
self.connection = TelnetConnection(
'fake', 'fake', 'fake', 'fake')
self.connection._connected = True
@@ -41,7 +41,7 @@ class TestDdwrt(unittest.TestCase):
super().run(result)
def setup_method(self, _):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'zone')
@@ -220,7 +220,7 @@ class TestDdwrt(unittest.TestCase):
with requests_mock.Mocker() as mock_request:
mock_request.register_uri(
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
# First request has to work to setup connection
# First request has to work to set up connection
[{'text': load_fixture('Ddwrt_Status_Wireless.txt')},
# Second request to get active devices fails
{'text': None}])
@@ -122,7 +122,7 @@ def geofency_client(loop, hass, aiohttp_client):
@pytest.fixture(autouse=True)
def setup_zones(loop, hass):
"""Setup Zone config in HA."""
"""Set up Zone config in HA."""
assert loop.run_until_complete(async_setup_component(
hass, zone.DOMAIN, {
'zone': {
+1 -1
View File
@@ -39,7 +39,7 @@ class TestComponentsDeviceTracker(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.yaml_devices = self.hass.config.path(device_tracker.YAML_DEVICES)
+1 -1
View File
@@ -19,7 +19,7 @@ class TestComponentsDeviceTrackerMQTT(unittest.TestCase):
"""Test MQTT device tracker platform."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
@@ -29,7 +29,7 @@ class TestComponentsDeviceTrackerJSONMQTT(unittest.TestCase):
"""Test JSON MQTT device tracker platform."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
@@ -327,7 +327,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
# pylint: disable=invalid-name
def setup_method(self, _):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
mock_component(self.hass, 'group')
@@ -1316,7 +1316,7 @@ class TestDeviceTrackerOwnTrackConfigs(BaseMQTT):
# pylint: disable=invalid-name
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
mock_component(self.hass, 'group')
@@ -16,7 +16,7 @@ class TestTplink4DeviceScanner(unittest.TestCase):
"""Tests for the Tplink4DeviceScanner class."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
@@ -31,7 +31,7 @@ class TestComponentsDeviceTrackerUnifiDirect(unittest.TestCase):
'unifi_direct.UnifiDeviceScanner'
def setup_method(self, _):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'zone')
@@ -37,7 +37,7 @@ class TestUPCConnect:
"""Tests for the Ddwrt device tracker platform."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'zone')
mock_component(self.hass, 'group')
@@ -52,7 +52,7 @@ class TestUPCConnect:
'UPCDeviceScanner.async_scan_devices',
return_value=async_scan_devices_mock)
def test_setup_platform(self, scan_mock, aioclient_mock):
"""Setup a platform."""
"""Set up a platform."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'}
@@ -74,7 +74,7 @@ class TestUPCConnect:
@patch('homeassistant.components.device_tracker._LOGGER.error')
def test_setup_platform_timeout_webservice(self, mock_error,
aioclient_mock):
"""Setup a platform with api timeout."""
"""Set up a platform with api timeout."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'},
@@ -97,7 +97,7 @@ class TestUPCConnect:
@patch('homeassistant.components.device_tracker._LOGGER.error')
def test_setup_platform_timeout_loginpage(self, mock_error,
aioclient_mock):
"""Setup a platform with timeout on loginpage."""
"""Set up a platform with timeout on loginpage."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
exc=asyncio.TimeoutError()
@@ -120,7 +120,7 @@ class TestUPCConnect:
str(mock_error.call_args_list[-1])
def test_scan_devices(self, aioclient_mock):
"""Setup a upc platform and scan device."""
"""Set up a upc platform and scan device."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'}
@@ -156,7 +156,7 @@ class TestUPCConnect:
'70:EE:50:27:A1:38']
def test_scan_devices_without_session(self, aioclient_mock):
"""Setup a upc platform and scan device with no token."""
"""Set up a upc platform and scan device with no token."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'}
@@ -197,7 +197,7 @@ class TestUPCConnect:
'70:EE:50:27:A1:38']
def test_scan_devices_without_session_wrong_re(self, aioclient_mock):
"""Setup a upc platform and scan device with no token and wrong."""
"""Set up a upc platform and scan device with no token and wrong."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'}
@@ -237,7 +237,7 @@ class TestUPCConnect:
assert mac_list == []
def test_scan_devices_parse_error(self, aioclient_mock):
"""Setup a upc platform and scan device with parse error."""
"""Set up a upc platform and scan device with parse error."""
aioclient_mock.get(
"http://{}/common_page/login.html".format(self.host),
cookies={'sessionToken': '654321'}
@@ -26,7 +26,7 @@ JSON_HEADERS = {CONTENT_TYPE: const.CONTENT_TYPE_JSON}
@pytest.fixture
def hass_hue(loop, hass):
"""Setup a Home Assistant instance for these tests."""
"""Set up a Home Assistant instance for these tests."""
# We need to do this to get access to homeassistant/turn_(on,off)
loop.run_until_complete(
core_components.async_setup(hass, {core.DOMAIN: {}}))
+1 -1
View File
@@ -50,7 +50,7 @@ class TestEmulatedHue(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""Setup the class."""
"""Set up the class."""
cls.hass = hass = get_test_home_assistant()
# We need to do this to get access to homeassistant/turn_(on,off)
+1 -1
View File
@@ -68,7 +68,7 @@ class DysonTest(unittest.TestCase):
"""Dyson Sensor component test class."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
+1 -1
View File
@@ -13,7 +13,7 @@ class TestMqttFan(unittest.TestCase):
"""Test the MQTT fan platform."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -33,7 +33,7 @@ class TestTemplateFan:
# pylint: disable=invalid-name
def setup_method(self, method):
"""Setup."""
"""Set up."""
self.hass = get_test_home_assistant()
self.calls = []
+4 -4
View File
@@ -19,7 +19,7 @@ class TestComponentsGroup(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
# pylint: disable=invalid-name
@@ -28,7 +28,7 @@ class TestComponentsGroup(unittest.TestCase):
self.hass.stop()
def test_setup_group_with_mixed_groupable_states(self):
"""Try to setup a group with mixed groupable states."""
"""Try to set up a group with mixed groupable states."""
self.hass.states.set('light.Bowl', STATE_ON)
self.hass.states.set('device_tracker.Paulus', STATE_HOME)
group.Group.create_group(
@@ -41,7 +41,7 @@ class TestComponentsGroup(unittest.TestCase):
group.ENTITY_ID_FORMAT.format('person_and_light')).state)
def test_setup_group_with_a_non_existing_state(self):
"""Try to setup a group with a non existing state."""
"""Try to set up a group with a non existing state."""
self.hass.states.set('light.Bowl', STATE_ON)
grp = group.Group.create_group(
@@ -62,7 +62,7 @@ class TestComponentsGroup(unittest.TestCase):
self.assertEqual(STATE_UNKNOWN, grp.state)
def test_setup_empty_group(self):
"""Try to setup an empty group."""
"""Try to set up an empty group."""
grp = group.Group.create_group(self.hass, 'nothing', [])
self.assertEqual(STATE_UNKNOWN, grp.state)
+2 -2
View File
@@ -38,7 +38,7 @@ async def mock_handler(request):
@pytest.fixture
def app(hass):
"""Fixture to setup a web.Application."""
"""Fixture to set up a web.Application."""
app = web.Application()
app['hass'] = hass
app.router.add_get('/', mock_handler)
@@ -48,7 +48,7 @@ def app(hass):
@pytest.fixture
def app2(hass):
"""Fixture to setup a web.Application without real_ip middleware."""
"""Fixture to set up a web.Application without real_ip middleware."""
app = web.Application()
app['hass'] = hass
app.router.add_get('/', mock_handler)
+1 -1
View File
@@ -49,7 +49,7 @@ async def mock_handler(request):
@pytest.fixture
def client(loop, aiohttp_client):
"""Fixture to setup a web.Application."""
"""Fixture to set up a web.Application."""
app = web.Application()
app.router.add_get('/', mock_handler)
setup_cors(app, [TRUSTED_ORIGIN])
+1 -1
View File
@@ -8,7 +8,7 @@ from tests.common import mock_coro, MockConfigEntry
async def test_setup_with_no_config(hass):
"""Test that we do not discover anything or try to setup a bridge."""
"""Test that we do not discover anything or try to set up a bridge."""
with patch.object(hass, 'config_entries') as mock_config_entries, \
patch.object(hue, 'configured_hosts', return_value=[]):
assert await async_setup_component(hass, hue.DOMAIN, {}) is True
@@ -141,13 +141,13 @@ def test_valid_file_path():
async def test_setup_platform(hass, mock_healthybox):
"""Setup platform with one entity."""
"""Set up platform with one entity."""
await async_setup_component(hass, ip.DOMAIN, VALID_CONFIG)
assert hass.states.get(VALID_ENTITY_ID)
async def test_setup_platform_with_auth(hass, mock_healthybox):
"""Setup platform with one entity and auth."""
"""Set up platform with one entity and auth."""
valid_config_auth = VALID_CONFIG.copy()
valid_config_auth[ip.DOMAIN][CONF_USERNAME] = MOCK_USERNAME
valid_config_auth[ip.DOMAIN][CONF_PASSWORD] = MOCK_PASSWORD
@@ -297,7 +297,7 @@ async def test_teach_service(
async def test_setup_platform_with_name(hass, mock_healthybox):
"""Setup platform with one entity and a name."""
"""Set up platform with one entity and a name."""
named_entity_id = 'image_processing.{}'.format(MOCK_NAME)
valid_config_named = VALID_CONFIG.copy()
+11 -11
View File
@@ -16,7 +16,7 @@ class TestSetupImageProcessing:
"""Test class for setup image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -24,7 +24,7 @@ class TestSetupImageProcessing:
self.hass.stop()
def test_setup_component(self):
"""Setup demo platform on image_process component."""
"""Set up demo platform on image_process component."""
config = {
ip.DOMAIN: {
'platform': 'demo'
@@ -35,7 +35,7 @@ class TestSetupImageProcessing:
setup_component(self.hass, ip.DOMAIN, config)
def test_setup_component_with_service(self):
"""Setup demo platform on image_process component test service."""
"""Set up demo platform on image_process component test service."""
config = {
ip.DOMAIN: {
'platform': 'demo'
@@ -52,7 +52,7 @@ class TestImageProcessing:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
setup_component(
@@ -113,7 +113,7 @@ class TestImageProcessingAlpr:
"""Test class for alpr image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
config = {
@@ -149,7 +149,7 @@ class TestImageProcessingAlpr:
self.hass.stop()
def test_alpr_event_single_call(self, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.demo_alpr')
@@ -168,7 +168,7 @@ class TestImageProcessingAlpr:
assert event_data[0]['entity_id'] == 'image_processing.demo_alpr'
def test_alpr_event_double_call(self, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.demo_alpr')
@@ -192,7 +192,7 @@ class TestImageProcessingAlpr:
new_callable=PropertyMock(return_value=95))
def test_alpr_event_single_call_confidence(self, confidence_mock,
aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.demo_alpr')
@@ -215,7 +215,7 @@ class TestImageProcessingFace:
"""Test class for face image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
config = {
@@ -251,7 +251,7 @@ class TestImageProcessingFace:
self.hass.stop()
def test_face_event_call(self, aioclient_mock):
"""Setup and scan a picture and test faces from event."""
"""Set up and scan a picture and test faces from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.demo_face')
@@ -276,7 +276,7 @@ class TestImageProcessingFace:
'DemoImageProcessingFace.confidence',
new_callable=PropertyMock(return_value=None))
def test_face_event_call_no_confidence(self, mock_config, aioclient_mock):
"""Setup and scan a picture and test faces from event."""
"""Set up and scan a picture and test faces from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.demo_face')
@@ -15,7 +15,7 @@ class TestMicrosoftFaceDetectSetup:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -25,7 +25,7 @@ class TestMicrosoftFaceDetectSetup:
@patch('homeassistant.components.microsoft_face.'
'MicrosoftFace.update_store', return_value=mock_coro())
def test_setup_platform(self, store_mock):
"""Setup platform with one entity."""
"""Set up platform with one entity."""
config = {
ip.DOMAIN: {
'platform': 'microsoft_face_detect',
@@ -51,7 +51,7 @@ class TestMicrosoftFaceDetectSetup:
@patch('homeassistant.components.microsoft_face.'
'MicrosoftFace.update_store', return_value=mock_coro())
def test_setup_platform_name(self, store_mock):
"""Setup platform with one entity and set name."""
"""Set up platform with one entity and set name."""
config = {
ip.DOMAIN: {
'platform': 'microsoft_face_detect',
@@ -78,7 +78,7 @@ class TestMicrosoftFaceDetect:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.config = {
@@ -108,7 +108,7 @@ class TestMicrosoftFaceDetect:
'MicrosoftFaceDetectEntity.should_poll',
new_callable=PropertyMock(return_value=False))
def test_ms_detect_process_image(self, poll_mock, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(
self.endpoint_url.format("persongroups"),
text=load_fixture('microsoft_face_persongroups.json')
@@ -15,7 +15,7 @@ class TestMicrosoftFaceIdentifySetup:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -25,7 +25,7 @@ class TestMicrosoftFaceIdentifySetup:
@patch('homeassistant.components.microsoft_face.'
'MicrosoftFace.update_store', return_value=mock_coro())
def test_setup_platform(self, store_mock):
"""Setup platform with one entity."""
"""Set up platform with one entity."""
config = {
ip.DOMAIN: {
'platform': 'microsoft_face_identify',
@@ -51,7 +51,7 @@ class TestMicrosoftFaceIdentifySetup:
@patch('homeassistant.components.microsoft_face.'
'MicrosoftFace.update_store', return_value=mock_coro())
def test_setup_platform_name(self, store_mock):
"""Setup platform with one entity and set name."""
"""Set up platform with one entity and set name."""
config = {
ip.DOMAIN: {
'platform': 'microsoft_face_identify',
@@ -79,7 +79,7 @@ class TestMicrosoftFaceIdentify:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.config = {
@@ -109,7 +109,7 @@ class TestMicrosoftFaceIdentify:
'MicrosoftFaceIdentifyEntity.should_poll',
new_callable=PropertyMock(return_value=False))
def test_ms_identify_process_image(self, poll_mock, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(
self.endpoint_url.format("persongroups"),
text=load_fixture('microsoft_face_persongroups.json')
@@ -16,7 +16,7 @@ class TestOpenAlprCloudSetup:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -24,7 +24,7 @@ class TestOpenAlprCloudSetup:
self.hass.stop()
def test_setup_platform(self):
"""Setup platform with one entity."""
"""Set up platform with one entity."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_cloud',
@@ -45,7 +45,7 @@ class TestOpenAlprCloudSetup:
assert self.hass.states.get('image_processing.openalpr_demo_camera')
def test_setup_platform_name(self):
"""Setup platform with one entity and set name."""
"""Set up platform with one entity and set name."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_cloud',
@@ -67,7 +67,7 @@ class TestOpenAlprCloudSetup:
assert self.hass.states.get('image_processing.test_local')
def test_setup_platform_without_api_key(self):
"""Setup platform with one entity without api_key."""
"""Set up platform with one entity without api_key."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_cloud',
@@ -85,7 +85,7 @@ class TestOpenAlprCloudSetup:
setup_component(self.hass, ip.DOMAIN, config)
def test_setup_platform_without_region(self):
"""Setup platform with one entity without region."""
"""Set up platform with one entity without region."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_cloud',
@@ -107,7 +107,7 @@ class TestOpenAlprCloud:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
config = {
@@ -151,7 +151,7 @@ class TestOpenAlprCloud:
self.hass.stop()
def test_openalpr_process_image(self, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.post(
OPENALPR_API_URL, params=self.params,
text=load_fixture('alpr_cloud.json'), status=200
@@ -179,7 +179,7 @@ class TestOpenAlprCloud:
'image_processing.test_local'
def test_openalpr_process_image_api_error(self, aioclient_mock):
"""Setup and scan a picture and test api error."""
"""Set up and scan a picture and test api error."""
aioclient_mock.post(
OPENALPR_API_URL, params=self.params,
text="{'error': 'error message'}", status=400
@@ -195,7 +195,7 @@ class TestOpenAlprCloud:
assert len(self.alpr_events) == 0
def test_openalpr_process_image_api_timeout(self, aioclient_mock):
"""Setup and scan a picture and test api error."""
"""Set up and scan a picture and test api error."""
aioclient_mock.post(
OPENALPR_API_URL, params=self.params,
exc=asyncio.TimeoutError()
@@ -30,7 +30,7 @@ class TestOpenAlprLocalSetup:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self):
@@ -38,7 +38,7 @@ class TestOpenAlprLocalSetup:
self.hass.stop()
def test_setup_platform(self):
"""Setup platform with one entity."""
"""Set up platform with one entity."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_local',
@@ -58,7 +58,7 @@ class TestOpenAlprLocalSetup:
assert self.hass.states.get('image_processing.openalpr_demo_camera')
def test_setup_platform_name(self):
"""Setup platform with one entity and set name."""
"""Set up platform with one entity and set name."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_local',
@@ -79,7 +79,7 @@ class TestOpenAlprLocalSetup:
assert self.hass.states.get('image_processing.test_local')
def test_setup_platform_without_region(self):
"""Setup platform with one entity without region."""
"""Set up platform with one entity without region."""
config = {
ip.DOMAIN: {
'platform': 'openalpr_local',
@@ -100,7 +100,7 @@ class TestOpenAlprLocal:
"""Test class for image processing."""
def setup_method(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
config = {
@@ -143,7 +143,7 @@ class TestOpenAlprLocal:
@patch('asyncio.create_subprocess_exec',
return_value=mock_async_subprocess())
def test_openalpr_process_image(self, popen_mock, aioclient_mock):
"""Setup and scan a picture and test plates from event."""
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b'image')
ip.scan(self.hass, entity_id='image_processing.test_local')
+1 -1
View File
@@ -15,7 +15,7 @@ class TestDemoLight(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.assertTrue(setup_component(self.hass, light.DOMAIN, {'light': {
'platform': 'demo',
+1 -1
View File
@@ -22,7 +22,7 @@ class TestLight(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
# pylint: disable=invalid-name
+1 -1
View File
@@ -21,7 +21,7 @@ class TestLiteJetLight(unittest.TestCase):
@mock.patch('pylitejet.LiteJet')
def setup_method(self, method, mock_pylitejet):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.start()
+4 -4
View File
@@ -28,7 +28,7 @@ class TestMochadSwitchSetup(unittest.TestCase):
THING = 'light'
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -57,7 +57,7 @@ class TestMochadLight(unittest.TestCase):
"""Test for mochad light platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
controller_mock = mock.MagicMock()
dev_dict = {'address': 'a1', 'name': 'fake_light',
@@ -94,7 +94,7 @@ class TestMochadLight256Levels(unittest.TestCase):
"""Test for mochad light platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
controller_mock = mock.MagicMock()
dev_dict = {'address': 'a1', 'name': 'fake_light',
@@ -126,7 +126,7 @@ class TestMochadLight64Levels(unittest.TestCase):
"""Test for mochad light platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
controller_mock = mock.MagicMock()
dev_dict = {'address': 'a1', 'name': 'fake_light',
+1 -1
View File
@@ -158,7 +158,7 @@ class TestLightMQTT(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -107,7 +107,7 @@ class TestLightMQTTJSON(unittest.TestCase):
"""Test the MQTT JSON light."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -43,7 +43,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
"""Test the MQTT Template light."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
+1 -1
View File
@@ -14,7 +14,7 @@ class TestLightRfxtrx(unittest.TestCase):
"""Test the Rfxtrx light platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_component(self.hass, 'rfxtrx')
+1 -1
View File
@@ -20,7 +20,7 @@ class TestTemplateLight:
# pylint: disable=invalid-name
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.calls = []
+1 -1
View File
@@ -14,7 +14,7 @@ class TestLockDemo(unittest.TestCase):
"""Test the demo lock."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.assertTrue(setup_component(self.hass, lock.DOMAIN, {
'lock': {
+1 -1
View File
@@ -13,7 +13,7 @@ class TestLockMQTT(unittest.TestCase):
"""Test the MQTT lock."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
@@ -123,7 +123,7 @@ class TestAsyncMediaPlayer(unittest.TestCase):
"""Test the media_player module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.player = AsyncMediaPlayer(self.hass)
@@ -176,7 +176,7 @@ class TestSyncMediaPlayer(unittest.TestCase):
"""Test the media_player module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.player = SyncMediaPlayer(self.hass)
+3 -3
View File
@@ -48,7 +48,7 @@ def get_fake_chromecast_info(host='192.168.178.42', port=8009,
async def async_setup_cast(hass, config=None, discovery_info=None):
"""Helper to setup the cast platform."""
"""Helper to set up the cast platform."""
if config is None:
config = {}
add_devices = Mock()
@@ -62,7 +62,7 @@ async def async_setup_cast(hass, config=None, discovery_info=None):
async def async_setup_cast_internal_discovery(hass, config=None,
discovery_info=None):
"""Setup the cast platform and the discovery."""
"""Set up the cast platform and the discovery."""
listener = MagicMock(services={})
with patch('pychromecast.start_discovery',
@@ -85,7 +85,7 @@ async def async_setup_cast_internal_discovery(hass, config=None,
async def async_setup_media_player_cast(hass: HomeAssistantType,
info: ChromecastInfo):
"""Setup the cast platform with async_setup_component."""
"""Set up the cast platform with async_setup_component."""
chromecast = get_fake_chromecast(info)
cast.CastStatusListener = MagicMock()
+2 -2
View File
@@ -25,7 +25,7 @@ class TestDemoMediaPlayer(unittest.TestCase):
"""Test the media_player module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -227,7 +227,7 @@ class TestMediaPlayerWeb(unittest.TestCase):
"""Test the media player web views sensor."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
assert setup_component(self.hass, http.DOMAIN, {
+1 -1
View File
@@ -135,7 +135,7 @@ class TestSonosMediaPlayer(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def monkey_available(self):
@@ -148,7 +148,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
"""Bose Soundtouch test class."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
logging.disable(logging.CRITICAL)
@@ -158,7 +158,7 @@ class TestMediaPlayer(unittest.TestCase):
"""Test the media_player module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_mp_1 = MockMediaPlayer(self.hass, 'mock1')
+1 -1
View File
@@ -33,7 +33,7 @@ class TestYamahaMediaPlayer(unittest.TestCase):
"""Test the Yamaha media player."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.main_zone = _create_zone_mock('Main zone', 'http://main')
self.device = FakeYamahaDevice(
+2 -2
View File
@@ -45,7 +45,7 @@ class TestMQTTComponent(unittest.TestCase):
"""Test the MQTT component."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
self.calls = []
@@ -188,7 +188,7 @@ class TestMQTTCallbacks(unittest.TestCase):
"""Test the MQTT callbacks."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
mock_mqtt_client(self.hass)
self.calls = []
+4 -4
View File
@@ -18,7 +18,7 @@ class TestMQTT:
"""Test the MQTT component."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
@@ -33,7 +33,7 @@ class TestMQTT:
def test_creating_config_with_http_pass_only(self, mock_mqtt):
"""Test if the MQTT server failed starts.
Since 0.77, MQTT server has to setup its own password.
Since 0.77, MQTT server has to set up its own password.
If user has api_password but don't have mqtt.password, MQTT component
will fail to start
"""
@@ -51,7 +51,7 @@ class TestMQTT:
def test_creating_config_with_pass_and_no_http_pass(self, mock_mqtt):
"""Test if the MQTT server gets started with password.
Since 0.77, MQTT server has to setup its own password.
Since 0.77, MQTT server has to set up its own password.
"""
mock_mqtt().async_connect.return_value = mock_coro(True)
self.hass.bus.listen_once = MagicMock()
@@ -74,7 +74,7 @@ class TestMQTT:
def test_creating_config_with_pass_and_http_pass(self, mock_mqtt):
"""Test if the MQTT server gets started with password.
Since 0.77, MQTT server has to setup its own password.
Since 0.77, MQTT server has to set up its own password.
"""
mock_mqtt().async_connect.return_value = mock_coro(True)
self.hass.bus.listen_once = MagicMock()
+1 -1
View File
@@ -28,7 +28,7 @@ class TestApns(unittest.TestCase):
"""Test the APNS component."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
+1 -1
View File
@@ -13,7 +13,7 @@ class TestCommandLine(unittest.TestCase):
"""Test the command line notifications."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
+1 -1
View File
@@ -20,7 +20,7 @@ class TestNotifyDemo(unittest.TestCase):
"""Test the demo notify."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.events = []
self.calls = []
+1 -1
View File
@@ -16,7 +16,7 @@ class TestNotifyFile(unittest.TestCase):
"""Test the file notify."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
+1 -1
View File
@@ -14,7 +14,7 @@ class TestNotifyGroup(unittest.TestCase):
"""Test the notify.group platform."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.events = []
self.service1 = demo.DemoNotificationService(self.hass)
+1 -1
View File
@@ -19,7 +19,7 @@ class TestNotifySmtp(unittest.TestCase):
"""Test the smtp notify."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mailer = MockSMTP('localhost', 25, 5, 'test@test.com', 1,
'testuser', 'testpass',
@@ -9,7 +9,7 @@ class TestPersistentNotification:
"""Test persistent notification component."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
setup_component(self.hass, pn.DOMAIN, {})
+2 -2
View File
@@ -19,7 +19,7 @@ class TestRecorder(unittest.TestCase):
"""Test the recorder module."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
init_recorder_component(self.hass)
self.hass.start()
@@ -92,7 +92,7 @@ def hass_recorder():
hass = get_test_home_assistant()
def setup_recorder(config=None):
"""Setup with params."""
"""Set up with params."""
init_recorder_component(hass, config)
hass.start()
hass.block_till_done()
+1 -1
View File
@@ -16,7 +16,7 @@ class TestRecorderPurge(unittest.TestCase):
"""Base class for common recorder tests."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
init_recorder_component(self.hass)
self.hass.start()
+1 -1
View File
@@ -14,7 +14,7 @@ def hass_recorder():
hass = get_test_home_assistant()
def setup_recorder(config=None):
"""Setup with params."""
"""Set up with params."""
init_recorder_component(hass, config)
hass.start()
hass.block_till_done()
+1 -1
View File
@@ -15,7 +15,7 @@ class TestDemoRemote(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.assertTrue(setup_component(self.hass, remote.DOMAIN, {'remote': {
'platform': 'demo',
+1 -1
View File
@@ -19,7 +19,7 @@ class TestRemote(unittest.TestCase):
# pylint: disable=invalid-name
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
# pylint: disable=invalid-name
+1 -1
View File
@@ -14,7 +14,7 @@ class TestScene(unittest.TestCase):
"""Test the scene component."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
test_light = loader.get_component(self.hass, 'light.test')
test_light.init()
+1 -1
View File
@@ -21,7 +21,7 @@ class TestLiteJetScene(unittest.TestCase):
@mock.patch('pylitejet.LiteJet')
def setup_method(self, method, mock_pylitejet):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.start()
+1 -1
View File
@@ -11,7 +11,7 @@ class TestCommandSensorSensor(unittest.TestCase):
"""Test the Command line sensor."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
+1 -1
View File
@@ -52,7 +52,7 @@ class DysonTest(unittest.TestCase):
"""Dyson Sensor component test class."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
+1 -1
View File
@@ -17,7 +17,7 @@ class TestFilterSensor(unittest.TestCase):
"""Test the Data Filter sensor."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
raw_values = [20, 19, 18, 21, 22, 0]
self.values = []
+3 -3
View File
@@ -36,7 +36,7 @@ class TestGoogleWifiSetup(unittest.TestCase):
"""Tests for setting up the Google Wifi sensor platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
@@ -83,7 +83,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
"""Tests for Google Wifi sensor platform."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
with requests_mock.Mocker() as mock_req:
self.setup_api(MOCK_DATA, mock_req)
@@ -93,7 +93,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
self.hass.stop()
def setup_api(self, data, mock_req):
"""Setup API with fake data."""
"""Set up API with fake data."""
resource = '{}{}{}'.format(
'http://', 'localhost', google_wifi.ENDPOINT)
now = datetime(1970, month=1, day=1)
@@ -17,7 +17,7 @@ class FakeEMailReader:
"""A test class for sending test emails."""
def __init__(self, messages):
"""Setup the fake email reader."""
"""Set up the fake email reader."""
self._messages = messages
def connect(self):
@@ -35,7 +35,7 @@ class EmailContentSensor(unittest.TestCase):
"""Test the IMAP email content sensor."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self):
+2 -2
View File
@@ -31,7 +31,7 @@ class TestMfiSensorSetup(unittest.TestCase):
}
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
@@ -131,7 +131,7 @@ class TestMfiSensor(unittest.TestCase):
"""Test for mFi sensor platform."""
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.port = mock.MagicMock()
self.sensor = mfi.MfiSensor(self.port, self.hass)
+1 -1
View File
@@ -15,7 +15,7 @@ class TestMHZ19Sensor(unittest.TestCase):
hass = None
def setup_method(self, method):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
@@ -15,7 +15,7 @@ class TestSensorMoldIndicator(unittest.TestCase):
"""Test the MoldIndicator sensor."""
def setUp(self):
"""Setup things to be run when tests are started."""
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.hass.states.set('test.indoortemp', '20',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
Loaded 100 of 244 files, more files were not shown because too many files have changed in this diff. Show more