mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-07-15 17:31:46 +00:00
add text unit tests
This commit is contained in:
parent
040a41daa7
commit
d0c96b853d
@ -71,6 +71,13 @@ def pytest_sessionstart(session):
|
|||||||
},
|
},
|
||||||
sceneItemEnabled=True,
|
sceneItemEnabled=True,
|
||||||
)
|
)
|
||||||
|
session.obsws.create_input(
|
||||||
|
sceneName='pytest_scene',
|
||||||
|
inputName='pytest_text_input',
|
||||||
|
inputKind='text_gdiplus_v3',
|
||||||
|
inputSettings={'text': 'Hello, OBS!'},
|
||||||
|
sceneItemEnabled=True,
|
||||||
|
)
|
||||||
resp = session.obsws.get_scene_item_list('pytest_scene')
|
resp = session.obsws.get_scene_item_list('pytest_scene')
|
||||||
for item in resp.scene_items:
|
for item in resp.scene_items:
|
||||||
if item['sourceName'] == 'pytest_input_2':
|
if item['sourceName'] == 'pytest_input_2':
|
||||||
|
18
tests/test_text.py
Normal file
18
tests/test_text.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
"""Unit tests for the text command in the OBS WebSocket CLI."""
|
||||||
|
|
||||||
|
from typer.testing import CliRunner
|
||||||
|
|
||||||
|
from obsws_cli.app import app
|
||||||
|
|
||||||
|
runner = CliRunner(mix_stderr=False)
|
||||||
|
|
||||||
|
|
||||||
|
def test_text_update():
|
||||||
|
"""Test the text update command."""
|
||||||
|
result = runner.invoke(app, ['text', 'current', 'pytest_text_input'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Current text for input pytest_text_input: Hello, OBS!' in result.stdout
|
||||||
|
|
||||||
|
result = runner.invoke(app, ['text', 'update', 'pytest_text_input', 'New Text'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Text for input pytest_text_input updated to: New Text' in result.stdout
|
Loading…
x
Reference in New Issue
Block a user