Exemple #1
0
 def unserialize(cls, step_data):
     kwargs = {
         "conditions": [Condition.unserialize(cond) for cond in step_data.get("conditions", ())],
         "actions": [Action.unserialize(action) for action in step_data.get("actions", ())],
     }
     if "next" in step_data:
         kwargs["next"] = StepNext(step_data["next"])
     if "cond_op" in step_data:
         kwargs["cond_op"] = StepConditionOperator(step_data["cond_op"])
     if "enabled" in step_data:
         kwargs["enabled"] = bool(step_data["enabled"])
     return cls(**kwargs)
Exemple #2
0
 def unserialize(cls, step_data):
     kwargs = {
         "conditions": [Condition.unserialize(cond) for cond in step_data.get("conditions", ())],
         "actions": [Action.unserialize(action) for action in step_data.get("actions", ())],
     }
     if "next" in step_data:
         kwargs["next"] = StepNext(step_data["next"])
     if "cond_op" in step_data:
         kwargs["cond_op"] = StepConditionOperator(step_data["cond_op"])
     if "enabled" in step_data:
         kwargs["enabled"] = bool(step_data["enabled"])
     return cls(**kwargs)
def test_render_template():
    step = Step(
        conditions=(),
        actions=[Action.unserialize(action) for action in TEST_STEP_ACTIONS],
    )
    assert step

    execution_context = Context(variables={
        "customer_phone": "0594036495",
        "language": "fi",
        "customer_email": "*****@*****.**"
    })

    step.execute(context=execution_context)
Exemple #4
0
def test_render_template():
    step = Step(
        conditions=(),
        actions=[Action.unserialize(action) for action in TEST_STEP_ACTIONS],
    )
    assert step

    execution_context = Context(variables={
        "customer_phone": "0594036495",
        "language": "fi",
        "customer_email": "*****@*****.**"
    })

    step.execute(context=execution_context)