@@ -262,6 +262,50 @@ def test_cli_structure(snapshot: SnapshotAssertion) -> None:
262262# ---------------------------------------------------------------------------
263263
264264
265+ @pytest .mark .usefixtures ("stable_terminal" )
266+ def test_on_command (
267+ runner : CliRunner ,
268+ snapshot : SnapshotAssertion ,
269+ ) -> None :
270+ """On command turns on the device."""
271+ mock = _mock_wled (_device ())
272+ with patch ("wled.cli.WLED" , mock ):
273+ result = runner .invoke (cli , ["on" , "--host" , "example.com" ])
274+ assert result .exit_code == 0
275+ assert result .output == snapshot
276+ mock .return_value .master .assert_awaited_once_with (on = True )
277+
278+
279+ @pytest .mark .usefixtures ("stable_terminal" )
280+ def test_off_command (
281+ runner : CliRunner ,
282+ snapshot : SnapshotAssertion ,
283+ ) -> None :
284+ """Off command turns off the device."""
285+ mock = _mock_wled (_device ())
286+ with patch ("wled.cli.WLED" , mock ):
287+ result = runner .invoke (cli , ["off" , "--host" , "example.com" ])
288+ assert result .exit_code == 0
289+ assert result .output == snapshot
290+ mock .return_value .master .assert_awaited_once_with (on = False )
291+
292+
293+ @pytest .mark .usefixtures ("stable_terminal" )
294+ def test_brightness_command (
295+ runner : CliRunner ,
296+ snapshot : SnapshotAssertion ,
297+ ) -> None :
298+ """Brightness command sets device brightness."""
299+ mock = _mock_wled (_device ())
300+ with patch ("wled.cli.WLED" , mock ):
301+ result = runner .invoke (
302+ cli , ["brightness" , "--host" , "example.com" , "--brightness" , "200" ]
303+ )
304+ assert result .exit_code == 0
305+ assert result .output == snapshot
306+ mock .return_value .master .assert_awaited_once_with (brightness = 200 )
307+
308+
265309@pytest .mark .usefixtures ("stable_terminal" )
266310def test_info_command (
267311 runner : CliRunner ,
0 commit comments