import pytest
async def test_unknown_tasks(service_client):
with pytest.raises(service_client.TestsuiteTaskNotFound):
await service_client.run_task('unknown-task')
async def test_task_run(service_client, testpoint):
@testpoint('sample-task/action')
def task_action(data):
pass
await service_client.run_task('sample-task')
assert task_action.times_called == 1
async def test_task_spawn(service_client, testpoint):
@testpoint('sample-task/action')
def task_action(data):
pass
async with service_client.spawn_task('sample-task'):
await task_action.wait_call()
async def test_list_tasks(service_client):
tasks = await service_client.list_tasks()
assert 'sample-task' in tasks