Exemplo n.º 1
0
def test_decision_task_cannot_change_state_on_closed_workflow_execution():
    wfe = make_workflow_execution()
    wfe.start()
    task = DecisionTask(wfe, 123)

    wfe.complete(123)

    task.timeout.when.called_with(Timeout(task, 0, "foo")).should.throw(
        SWFWorkflowExecutionClosedError)
    task.complete.when.called_with().should.throw(SWFWorkflowExecutionClosedError)
Exemplo n.º 2
0
def test_timeout_creation():
    wfe = make_workflow_execution()

    # epoch 1420113600 == "2015-01-01 13:00:00"
    timeout = Timeout(wfe, 1420117200, "START_TO_CLOSE")

    with freeze_time("2015-01-01 12:00:00"):
        timeout.reached.should.be.falsy

    with freeze_time("2015-01-01 13:00:00"):
        timeout.reached.should.be.truthy
Exemplo n.º 3
0
def test_activity_task_cannot_change_state_on_closed_workflow_execution():
    wfe = make_workflow_execution()
    wfe.start()

    task = ActivityTask(
        activity_id="my-activity-123",
        activity_type="foo",
        input="optional",
        scheduled_event_id=117,
        timeouts=ACTIVITY_TASK_TIMEOUTS,
        workflow_execution=wfe,
    )
    wfe.complete(123)

    task.timeout.when.called_with(Timeout(task, 0, "foo")).should.throw(SWFWorkflowExecutionClosedError)
    task.complete.when.called_with().should.throw(SWFWorkflowExecutionClosedError)
    task.fail.when.called_with().should.throw(SWFWorkflowExecutionClosedError)