mirror of
https://github.com/onyx-and-iris/slobs-cli.git
synced 2026-04-18 15:03:45 +00:00
add ruff config
run files through formatter add dosctrings to satisfy the linter
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
"""Tests for the stream commands in slobs_cli."""
|
||||
|
||||
import anyio
|
||||
import pytest
|
||||
from asyncclick.testing import CliRunner
|
||||
@@ -7,33 +9,35 @@ from slobs_cli import cli
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_stream_start():
|
||||
"""Test the start stream command."""
|
||||
runner = CliRunner()
|
||||
result = await runner.invoke(cli, ["stream", "status"])
|
||||
result = await runner.invoke(cli, ['stream', 'status'])
|
||||
assert result.exit_code == 0
|
||||
active = "Stream is currently active." in result.output
|
||||
active = 'Stream is currently active.' in result.output
|
||||
|
||||
result = await runner.invoke(cli, ["stream", "start"])
|
||||
result = await runner.invoke(cli, ['stream', 'start'])
|
||||
if not active:
|
||||
assert result.exit_code == 0
|
||||
assert "Stream started" in result.output
|
||||
assert 'Stream started' in result.output
|
||||
await anyio.sleep(0.2) # Allow some time for the stream to start
|
||||
else:
|
||||
assert result.exit_code != 0
|
||||
assert "Stream is already active." in result.output
|
||||
assert 'Stream is already active.' in result.output
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_stream_stop():
|
||||
"""Test the stop stream command."""
|
||||
runner = CliRunner()
|
||||
result = await runner.invoke(cli, ["stream", "status"])
|
||||
result = await runner.invoke(cli, ['stream', 'status'])
|
||||
assert result.exit_code == 0
|
||||
active = "Stream is currently active." in result.output
|
||||
active = 'Stream is currently active.' in result.output
|
||||
|
||||
result = await runner.invoke(cli, ["stream", "stop"])
|
||||
result = await runner.invoke(cli, ['stream', 'stop'])
|
||||
if active:
|
||||
assert result.exit_code == 0
|
||||
assert "Stream stopped" in result.output
|
||||
assert 'Stream stopped' in result.output
|
||||
await anyio.sleep(0.2) # Allow some time for the stream to stop
|
||||
else:
|
||||
assert result.exit_code != 0
|
||||
assert "Stream is already inactive." in result.output
|
||||
assert 'Stream is already inactive.' in result.output
|
||||
|
||||
Reference in New Issue
Block a user