From 94f86424b6943125528b795134bafcff942b7b49 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Wed, 19 Jun 2024 20:38:43 +0100 Subject: [PATCH] Format files using Ruff --- src/alga/cli_power.py | 3 ++- tests/test_cli_power.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/alga/cli_power.py b/src/alga/cli_power.py index a524b4f..ffff49b 100644 --- a/src/alga/cli_power.py +++ b/src/alga/cli_power.py @@ -21,15 +21,16 @@ def on() -> None: cfg = config.get() send_magic_packet(cfg["mac"]) + @app.command() def screen_off() -> None: """Turn TV screen off""" client.request("ssap://com.webos.service.tvpower/power/turnOffScreen") + @app.command() def screen_on() -> None: """Turn TV screen on""" client.request("ssap://com.webos.service.tvpower/power/turnOnScreen") - diff --git a/tests/test_cli_power.py b/tests/test_cli_power.py index 8c563ae..74d2017 100644 --- a/tests/test_cli_power.py +++ b/tests/test_cli_power.py @@ -20,17 +20,23 @@ def test_off(mock_request: mock.MagicMock) -> None: def test_screen_off(mock_request: mock.MagicMock) -> None: result = runner.invoke(app, ["power", "screen-off"]) - mock_request.assert_called_once_with("ssap://com.webos.service.tvpower/power/turnOffScreen") + mock_request.assert_called_once_with( + "ssap://com.webos.service.tvpower/power/turnOffScreen" + ) assert result.exit_code == 0 assert result.stdout == "" + def test_screen_on(mock_request: mock.MagicMock) -> None: result = runner.invoke(app, ["power", "screen-on"]) - mock_request.assert_called_once_with("ssap://com.webos.service.tvpower/power/turnOnScreen") + mock_request.assert_called_once_with( + "ssap://com.webos.service.tvpower/power/turnOnScreen" + ) assert result.exit_code == 0 assert result.stdout == "" + @mock.patch("alga.config.get") @mock.patch("alga.cli_power.send_magic_packet") def test_on(