fmartingr
/
jeeves
Archived
1
0
Fork 0
This repository has been archived on 2021-02-14. You can view files and clone it, but cannot push or open issues or pull requests.
jeeves/jeeves/core/tests/test_tasks.py

29 lines
761 B
Python

import pytest
import pydantic
from jeeves.core.registry import ActionRegistry
def test_action_with_empty_parameters_ok():
action = ActionRegistry.get_action_cls(
"jeeves.core.actions.stub:StubNoParametersAction"
)
action()
action(parameters=None)
action(parameters={})
def test_action_with_parameters_ok():
action = ActionRegistry.get_action_cls(
"jeeves.core.actions.stub:StubParametersAction"
)
action(parameters=dict(mandatory="text", non_mandatory="text"))
def test_action_with_parameters_ko():
action = ActionRegistry.get_action_cls(
"jeeves.core.actions.stub:StubParametersAction"
)
with pytest.raises(pydantic.ValidationError):
action(parameters=dict(thisshould="fail"))