Skip to content

Commit

Permalink
Format files using Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenzer committed Jun 19, 2024
1 parent 003e9e8 commit 94f8642
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/alga/cli_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

10 changes: 8 additions & 2 deletions tests/test_cli_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 94f8642

Please sign in to comment.