Skip to content

Commit 29f8b5e

Browse files
authored
Support literal text via remote command (#642)
1 parent 7d03031 commit 29f8b5e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/rokuecp/rokuecp.py

+4
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ async def remote(self, key: str) -> None:
345345
------
346346
RokuError: Received an unexpected response from the Roku device.
347347
"""
348+
if key[:4] == "Lit_":
349+
await self.literal(key[4:])
350+
return
351+
348352
key_lower = key.lower()
349353
if key_lower not in VALID_REMOTE_KEYS:
350354
msg = f"Remote key is invalid: {key}"

tests/test_interface.py

+29
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,35 @@ async def test_remote_search(aresponses: ResponsesMockServer) -> None:
246246
await roku.remote("search")
247247

248248

249+
@pytest.mark.asyncio
250+
async def test_remote_literal(aresponses: ResponsesMockServer) -> None:
251+
"""Test remote literal keypress is handled correctly."""
252+
aresponses.add(
253+
MATCH_HOST,
254+
"/keypress/Lit_t",
255+
"POST",
256+
aresponses.Response(status=200),
257+
)
258+
259+
aresponses.add(
260+
MATCH_HOST,
261+
"/keypress/Lit_h",
262+
"POST",
263+
aresponses.Response(status=200),
264+
)
265+
266+
aresponses.add(
267+
MATCH_HOST,
268+
"/keypress/Lit_e",
269+
"POST",
270+
aresponses.Response(status=200),
271+
)
272+
273+
async with ClientSession() as session:
274+
roku = Roku(HOST, session=session)
275+
await roku.remote("Lit_the")
276+
277+
249278
@pytest.mark.asyncio
250279
async def test_search(aresponses: ResponsesMockServer) -> None:
251280
"""Test search is handled correctly."""

0 commit comments

Comments
 (0)