Rename MockToggleDevice to MockToggleEntity (#26644)

* Rename MockToggleDevice to MockToggleEntity

* Fix tests
This commit is contained in:
Erik Montnemery 2019-09-15 09:50:17 +02:00 committed by GitHub
parent 57833f5b1e
commit 6a60ebdb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 200 additions and 198 deletions

View file

@ -4,23 +4,23 @@ Provide a mock light platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.const import STATE_ON, STATE_OFF
from tests.common import MockToggleDevice
from tests.common import MockToggleEntity
DEVICES = []
ENTITIES = []
def init(empty=False):
"""Initialize the platform with devices."""
global DEVICES
"""Initialize the platform with entities."""
global ENTITIES
DEVICES = (
ENTITIES = (
[]
if empty
else [
MockToggleDevice("Ceiling", STATE_ON),
MockToggleDevice("Ceiling", STATE_OFF),
MockToggleDevice(None, STATE_OFF),
MockToggleEntity("Ceiling", STATE_ON),
MockToggleEntity("Ceiling", STATE_OFF),
MockToggleEntity(None, STATE_OFF),
]
)
@ -28,5 +28,5 @@ def init(empty=False):
async def async_setup_platform(
hass, config, async_add_entities_callback, discovery_info=None
):
"""Return mock devices."""
async_add_entities_callback(DEVICES)
"""Return mock entities."""
async_add_entities_callback(ENTITIES)

View file

@ -4,23 +4,23 @@ Provide a mock switch platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.const import STATE_ON, STATE_OFF
from tests.common import MockToggleDevice
from tests.common import MockToggleEntity
DEVICES = []
ENTITIES = []
def init(empty=False):
"""Initialize the platform with devices."""
global DEVICES
"""Initialize the platform with entities."""
global ENTITIES
DEVICES = (
ENTITIES = (
[]
if empty
else [
MockToggleDevice("AC", STATE_ON),
MockToggleDevice("AC", STATE_OFF),
MockToggleDevice(None, STATE_OFF),
MockToggleEntity("AC", STATE_ON),
MockToggleEntity("AC", STATE_OFF),
MockToggleEntity(None, STATE_OFF),
]
)
@ -28,5 +28,5 @@ def init(empty=False):
async def async_setup_platform(
hass, config, async_add_entities_callback, discovery_info=None
):
"""Find and return test switches."""
async_add_entities_callback(DEVICES)
"""Return mock entities."""
async_add_entities_callback(ENTITIES)