Exemple #1
0
def test_single_action_state_to_json_string():
    actions: List[List[Action]] = []
    action: Action = CallActivityAction(function_name="MyFunction",
                                        input_="AwesomeInput")
    actions.append([action])
    state = OrchestratorState(is_done=False, actions=actions, output=None)
    result = state.to_json_string()
    expected_result = ('{"isDone": false, "actions": [[{"actionType": 0, '
                       '"functionName": "MyFunction", "input": '
                       '"\\"AwesomeInput\\""}]]}')
    assert expected_result == result
Exemple #2
0
def base_expected_state(output=None) -> OrchestratorState:
    return OrchestratorState(is_done=False, actions=[], output=output)
Exemple #3
0
def test_empty_state_to_json_string():
    actions: List[List[Action]] = []
    state = OrchestratorState(is_done=False, actions=actions, output=None)
    result = state.to_json_string()
    expected_result = '{"isDone": false, "actions": []}'
    assert expected_result == result
Exemple #4
0
def add_continue_as_new_action(state: OrchestratorState, input_: str):
    action = ContinueAsNewAction(input_=input_)
    state.actions.append([action])
    state._is_done = True