From: Petr Hodina <[email protected]> Run 'button monitor 200' on sandbox and check that the output lists button1 and button2 and that the command returns 0 after the timeout.
Signed-off-by: Petr Hodina <[email protected]> --- test/py/tests/test_button.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/py/tests/test_button.py b/test/py/tests/test_button.py index f3f68169e14..494c7956543 100644 --- a/test/py/tests/test_button.py +++ b/test/py/tests/test_button.py @@ -37,3 +37,23 @@ def test_button_return_code(ubman): response = ubman.run_command('button nonexistent-button; echo rc:$?') assert('not found' in response) assert('rc:1' in response) + [email protected]('sandbox') [email protected]('cmd_button') +def test_button_monitor(ubman): + """Test the live monitor shows all buttons and exits on timeout""" + + response = ubman.run_command('button monitor 200; echo rc:$?') + assert('Button monitor' in response) + assert('button1' in response) + assert('button2' in response) + assert('rc:0' in response) + [email protected]('sandbox') [email protected]('cmd_button') +def test_button_monitor_bad_timeout(ubman): + """Test that an invalid monitor timeout is rejected""" + + response = ubman.run_command('button monitor abc; echo rc:$?') + assert('Button monitor' not in response) + assert('rc:1' in response) -- 2.55.0
