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
16 changes: 8 additions & 8 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,40 +602,40 @@ def __init__(
)


class MockToggleDevice(entity.ToggleEntity):
class MockToggleEntity(entity.ToggleEntity):
"""Provide a mock toggle device."""

def __init__(self, name, state):
"""Initialize the mock device."""
def __init__(self, name, state, unique_id=None):
"""Initialize the mock entity."""
self._name = name or DEVICE_DEFAULT_NAME
self._state = state
self.calls = []

@property
def name(self):
"""Return the name of the device if any."""
"""Return the name of the entity if any."""
self.calls.append(("name", {}))
return self._name

@property
def state(self):
"""Return the name of the device if any."""
"""Return the state of the entity if any."""
self.calls.append(("state", {}))
return self._state

@property
def is_on(self):
"""Return true if device is on."""
"""Return true if entity is on."""
self.calls.append(("is_on", {}))
return self._state == STATE_ON

def turn_on(self, **kwargs):
"""Turn the device on."""
"""Turn the entity on."""
self.calls.append(("turn_on", kwargs))
self._state = STATE_ON

def turn_off(self, **kwargs):
"""Turn the device off."""
"""Turn the entity off."""
self.calls.append(("turn_off", kwargs))
self._state = STATE_OFF

Expand Down
Loading