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/actions/stub.py

49 lines
1018 B
Python

"""
This is a collection of Actions provided for testing purposes only.
"""
from typing import Text, Optional
from jeeves.core.objects import Result
from .base import Action
class StubSuccessAction(Action):
id = "stub/success"
def execute(self, message=None):
return Result(success=True)
class StubNonSuccessAction(Action):
id = "stub/non-success"
def execute(self):
return Result(output="error!", success=False)
class StubUncaughtExceptionAction(Action):
id = "stub/uncaught-exception"
def execute(self):
raise Exception("Oh god...")
class StubNoParametersAction(StubSuccessAction):
"""
An empty Action that provides no configurable parameters.
"""
id = "stub/no-parameters"
class StubParametersAction(StubSuccessAction):
"""
An empty Action that provide two configurable parameters.
"""
id = "sub/parameters"
class Parameters(Action.Parameters):
mandatory: Text
non_mandatory: Optional[Text] = None