update toggle commands

add toggle record/toggle stream tests

pre-release patch bump
This commit is contained in:
2025-05-07 19:43:32 +01:00
parent 4bae164124
commit 4a41239e50
7 changed files with 67 additions and 21 deletions

View File

@@ -95,6 +95,10 @@ def pytest_sessionfinish(session, exitstatus):
if resp.output_active:
session.obsws.stop_stream()
resp = session.obsws.get_record_status()
if resp.output_active:
session.obsws.stop_record()
# Close the OBS WebSocket client connection
session.obsws.disconnect()

View File

@@ -30,3 +30,18 @@ def test_record_start_status_stop():
result = runner.invoke(app, ['record', 'status'])
assert result.exit_code == 0
assert 'Recording is not in progress.' in result.stdout
def test_record_toggle():
"""Test the record toggle command."""
result = runner.invoke(app, ['record', 'status'])
assert result.exit_code == 0
active = 'Recording is in progress.' in result.stdout
result = runner.invoke(app, ['record', 'toggle'])
assert result.exit_code == 0
time.sleep(0.5) # Wait for the recording to toggle
if active:
assert 'Recording stopped successfully.' in result.stdout
else:
assert 'Recording started successfully.' in result.stdout

View File

@@ -41,3 +41,20 @@ def test_stream_stop():
assert 'Streaming stopped successfully.' in result.stdout
else:
assert 'Streaming is not in progress, cannot stop.' in result.stdout
def test_stream_toggle():
"""Test the stream toggle command."""
result = runner.invoke(app, ['stream', 'status'])
assert result.exit_code == 0
active = 'Streaming is in progress' in result.stdout
result = runner.invoke(app, ['stream', 'toggle'])
assert result.exit_code == 0
time.sleep(2) # Wait for the stream to toggle
if active:
assert 'Streaming stopped successfully.' in result.stdout
else:
assert 'Streaming started successfully.' in result.stdout