This commit is contained in:
Steve Pulec 2017-02-23 21:37:43 -05:00
commit f37bad0e00
260 changed files with 6363 additions and 3766 deletions

View file

@ -11,15 +11,18 @@ from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
@mock_swf_deprecated
def test_poll_for_activity_task_when_one():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
resp = conn.poll_for_activity_task("test-domain", "activity-task-list", identity="surprise")
resp = conn.poll_for_activity_task(
"test-domain", "activity-task-list", identity="surprise")
resp["activityId"].should.equal("my-activity-001")
resp["taskToken"].should_not.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-1]["eventType"].should.equal("ActivityTaskStarted")
resp["events"][-1]["activityTaskStartedEventAttributes"].should.equal(
{"identity": "surprise", "scheduledEventId": 5}
@ -44,12 +47,14 @@ def test_poll_for_activity_task_on_non_existent_queue():
@mock_swf_deprecated
def test_count_pending_activity_tasks():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
resp = conn.count_pending_activity_tasks("test-domain", "activity-task-list")
resp = conn.count_pending_activity_tasks(
"test-domain", "activity-task-list")
resp.should.equal({"count": 1, "truncated": False})
@ -64,16 +69,20 @@ def test_count_pending_decision_tasks_on_non_existent_task_list():
@mock_swf_deprecated
def test_respond_activity_task_completed():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
resp = conn.respond_activity_task_completed(activity_token, result="result of the task")
resp = conn.respond_activity_task_completed(
activity_token, result="result of the task")
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-2]["eventType"].should.equal("ActivityTaskCompleted")
resp["events"][-2]["activityTaskCompletedEventAttributes"].should.equal(
{"result": "result of the task", "scheduledEventId": 5, "startedEventId": 6}
@ -83,13 +92,16 @@ def test_respond_activity_task_completed():
@mock_swf_deprecated
def test_respond_activity_task_completed_on_closed_workflow_execution():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
# bad: we're closing workflow execution manually, but endpoints are not coded for now..
# bad: we're closing workflow execution manually, but endpoints are not
# coded for now..
wfe = swf_backend.domains[0].workflow_executions[-1]
wfe.execution_status = "CLOSED"
# /bad
@ -102,11 +114,13 @@ def test_respond_activity_task_completed_on_closed_workflow_execution():
@mock_swf_deprecated
def test_respond_activity_task_completed_with_task_already_completed():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
conn.respond_activity_task_completed(activity_token)
@ -119,18 +133,21 @@ def test_respond_activity_task_completed_with_task_already_completed():
@mock_swf_deprecated
def test_respond_activity_task_failed():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
resp = conn.respond_activity_task_failed(activity_token,
reason="short reason",
details="long details")
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-2]["eventType"].should.equal("ActivityTaskFailed")
resp["events"][-2]["activityTaskFailedEventAttributes"].should.equal(
{"reason": "short reason", "details": "long details",
@ -144,7 +161,8 @@ def test_respond_activity_task_completed_with_wrong_token():
# because the safeguards are shared with RespondActivityTaskCompleted, so
# no need to retest everything end-to-end.
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
@ -158,11 +176,13 @@ def test_respond_activity_task_completed_with_wrong_token():
@mock_swf_deprecated
def test_record_activity_task_heartbeat():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
resp = conn.record_activity_task_heartbeat(activity_token)
resp.should.equal({"cancelRequested": False})
@ -171,11 +191,13 @@ def test_record_activity_task_heartbeat():
@mock_swf_deprecated
def test_record_activity_task_heartbeat_with_wrong_token():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
conn.record_activity_task_heartbeat.when.called_with(
"bad-token", details="some progress details"
@ -185,17 +207,21 @@ def test_record_activity_task_heartbeat_with_wrong_token():
@mock_swf_deprecated
def test_record_activity_task_heartbeat_sets_details_in_case_of_timeout():
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
with freeze_time("2015-01-01 12:00:00"):
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
conn.record_activity_task_heartbeat(activity_token, details="some progress details")
activity_token = conn.poll_for_activity_task(
"test-domain", "activity-task-list")["taskToken"]
conn.record_activity_task_heartbeat(
activity_token, details="some progress details")
with freeze_time("2015-01-01 12:05:30"):
# => Activity Task Heartbeat timeout reached!!
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-2]["eventType"].should.equal("ActivityTaskTimedOut")
attrs = resp["events"][-2]["activityTaskTimedOutEventAttributes"]
attrs["details"].should.equal("some progress details")

View file

@ -48,8 +48,10 @@ def test_list_activity_types():
conn.register_activity_type("test-domain", "c-test-activity", "v1.0")
all_activity_types = conn.list_activity_types("test-domain", "REGISTERED")
names = [activity_type["activityType"]["name"] for activity_type in all_activity_types["typeInfos"]]
names.should.equal(["a-test-activity", "b-test-activity", "c-test-activity"])
names = [activity_type["activityType"]["name"]
for activity_type in all_activity_types["typeInfos"]]
names.should.equal(
["a-test-activity", "b-test-activity", "c-test-activity"])
@mock_swf_deprecated
@ -62,8 +64,10 @@ def test_list_activity_types_reverse_order():
all_activity_types = conn.list_activity_types("test-domain", "REGISTERED",
reverse_order=True)
names = [activity_type["activityType"]["name"] for activity_type in all_activity_types["typeInfos"]]
names.should.equal(["c-test-activity", "b-test-activity", "a-test-activity"])
names = [activity_type["activityType"]["name"]
for activity_type in all_activity_types["typeInfos"]]
names.should.equal(
["c-test-activity", "b-test-activity", "a-test-activity"])
# DeprecateActivityType endpoint
@ -110,7 +114,8 @@ def test_describe_activity_type():
conn.register_activity_type("test-domain", "test-activity", "v1.0",
task_list="foo", default_task_heartbeat_timeout="32")
actype = conn.describe_activity_type("test-domain", "test-activity", "v1.0")
actype = conn.describe_activity_type(
"test-domain", "test-activity", "v1.0")
actype["configuration"]["defaultTaskList"]["name"].should.equal("foo")
infos = actype["typeInfo"]
infos["activityType"]["name"].should.equal("test-activity")

View file

@ -12,15 +12,19 @@ from ..utils import setup_workflow
def test_poll_for_decision_task_when_one():
conn = setup_workflow()
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
resp = conn.poll_for_decision_task("test-domain", "queue", identity="srv01")
resp = conn.poll_for_decision_task(
"test-domain", "queue", identity="srv01")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled", "DecisionTaskStarted"])
types.should.equal(["WorkflowExecutionStarted",
"DecisionTaskScheduled", "DecisionTaskStarted"])
resp["events"][-1]["decisionTaskStartedEventAttributes"]["identity"].should.equal("srv01")
resp[
"events"][-1]["decisionTaskStartedEventAttributes"]["identity"].should.equal("srv01")
@mock_swf_deprecated
@ -44,9 +48,11 @@ def test_poll_for_decision_task_on_non_existent_queue():
@mock_swf_deprecated
def test_poll_for_decision_task_with_reverse_order():
conn = setup_workflow()
resp = conn.poll_for_decision_task("test-domain", "queue", reverse_order=True)
resp = conn.poll_for_decision_task(
"test-domain", "queue", reverse_order=True)
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["DecisionTaskStarted", "DecisionTaskScheduled", "WorkflowExecutionStarted"])
types.should.equal(
["DecisionTaskStarted", "DecisionTaskScheduled", "WorkflowExecutionStarted"])
# CountPendingDecisionTasks endpoint
@ -89,7 +95,8 @@ def test_respond_decision_task_completed_with_no_decision():
)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal([
"WorkflowExecutionStarted",
@ -104,7 +111,8 @@ def test_respond_decision_task_completed_with_no_decision():
"startedEventId": 3,
})
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.describe_workflow_execution(
"test-domain", conn.run_id, "uid-abcd1234")
resp["latestExecutionContext"].should.equal("free-form context")
@ -123,7 +131,8 @@ def test_respond_decision_task_completed_on_close_workflow_execution():
resp = conn.poll_for_decision_task("test-domain", "queue")
task_token = resp["taskToken"]
# bad: we're closing workflow execution manually, but endpoints are not coded for now..
# bad: we're closing workflow execution manually, but endpoints are not
# coded for now..
wfe = swf_backend.domains[0].workflow_executions[-1]
wfe.execution_status = "CLOSED"
# /bad
@ -155,10 +164,12 @@ def test_respond_decision_task_completed_with_complete_workflow_execution():
"decisionType": "CompleteWorkflowExecution",
"completeWorkflowExecutionDecisionAttributes": {"result": "foo bar"}
}]
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
resp = conn.respond_decision_task_completed(
task_token, decisions=decisions)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal([
"WorkflowExecutionStarted",
@ -167,7 +178,8 @@ def test_respond_decision_task_completed_with_complete_workflow_execution():
"DecisionTaskCompleted",
"WorkflowExecutionCompleted",
])
resp["events"][-1]["workflowExecutionCompletedEventAttributes"]["result"].should.equal("foo bar")
resp["events"][-1]["workflowExecutionCompletedEventAttributes"][
"result"].should.equal("foo bar")
@mock_swf_deprecated
@ -255,10 +267,12 @@ def test_respond_decision_task_completed_with_fail_workflow_execution():
"decisionType": "FailWorkflowExecution",
"failWorkflowExecutionDecisionAttributes": {"reason": "my rules", "details": "foo"}
}]
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
resp = conn.respond_decision_task_completed(
task_token, decisions=decisions)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal([
"WorkflowExecutionStarted",
@ -294,10 +308,12 @@ def test_respond_decision_task_completed_with_schedule_activity_task():
},
}
}]
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
resp = conn.respond_decision_task_completed(
task_token, decisions=decisions)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal([
"WorkflowExecutionStarted",
@ -320,5 +336,6 @@ def test_respond_decision_task_completed_with_schedule_activity_task():
},
})
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.describe_workflow_execution(
"test-domain", conn.run_id, "uid-abcd1234")
resp["latestActivityTaskTimestamp"].should.equal(1420113600.0)

View file

@ -102,7 +102,8 @@ def test_describe_domain():
conn.register_domain("test-domain", "60", description="A test domain")
domain = conn.describe_domain("test-domain")
domain["configuration"]["workflowExecutionRetentionPeriodInDays"].should.equal("60")
domain["configuration"][
"workflowExecutionRetentionPeriodInDays"].should.equal("60")
domain["domainInfo"]["description"].should.equal("A test domain")
domain["domainInfo"]["name"].should.equal("test-domain")
domain["domainInfo"]["status"].should.equal("REGISTERED")

View file

@ -11,19 +11,23 @@ from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
def test_activity_task_heartbeat_timeout():
with freeze_time("2015-01-01 12:00:00"):
conn = setup_workflow()
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
decision_token = conn.poll_for_decision_task(
"test-domain", "queue")["taskToken"]
conn.respond_decision_task_completed(decision_token, decisions=[
SCHEDULE_ACTIVITY_TASK_DECISION
])
conn.poll_for_activity_task("test-domain", "activity-task-list", identity="surprise")
conn.poll_for_activity_task(
"test-domain", "activity-task-list", identity="surprise")
with freeze_time("2015-01-01 12:04:30"):
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-1]["eventType"].should.equal("ActivityTaskStarted")
with freeze_time("2015-01-01 12:05:30"):
# => Activity Task Heartbeat timeout reached!!
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-2]["eventType"].should.equal("ActivityTaskTimedOut")
attrs = resp["events"][-2]["activityTaskTimedOutEventAttributes"]
@ -44,7 +48,8 @@ def test_decision_task_start_to_close_timeout():
conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
with freeze_time("2015-01-01 12:04:30"):
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -53,7 +58,8 @@ def test_decision_task_start_to_close_timeout():
with freeze_time("2015-01-01 12:05:30"):
# => Decision Task Start to Close timeout reached!!
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -77,7 +83,8 @@ def test_workflow_execution_start_to_close_timeout():
conn = setup_workflow()
with freeze_time("2015-01-01 13:59:30"):
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -86,11 +93,13 @@ def test_workflow_execution_start_to_close_timeout():
with freeze_time("2015-01-01 14:00:30"):
# => Workflow Execution Start to Close timeout reached!!
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
["WorkflowExecutionStarted", "DecisionTaskScheduled", "WorkflowExecutionTimedOut"]
["WorkflowExecutionStarted", "DecisionTaskScheduled",
"WorkflowExecutionTimedOut"]
)
attrs = resp["events"][-1]["workflowExecutionTimedOutEventAttributes"]
attrs.should.equal({

View file

@ -30,14 +30,16 @@ def setup_swf_environment():
def test_start_workflow_execution():
conn = setup_swf_environment()
wf = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
wf = conn.start_workflow_execution(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
wf.should.contain("runId")
@mock_swf_deprecated
def test_start_already_started_workflow_execution():
conn = setup_swf_environment()
conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
conn.start_workflow_execution(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
conn.start_workflow_execution.when.called_with(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
@ -58,11 +60,14 @@ def test_start_workflow_execution_on_deprecated_type():
@mock_swf_deprecated
def test_describe_workflow_execution():
conn = setup_swf_environment()
hsh = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
hsh = conn.start_workflow_execution(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
run_id = hsh["runId"]
wfe = conn.describe_workflow_execution("test-domain", run_id, "uid-abcd1234")
wfe["executionInfo"]["execution"]["workflowId"].should.equal("uid-abcd1234")
wfe = conn.describe_workflow_execution(
"test-domain", run_id, "uid-abcd1234")
wfe["executionInfo"]["execution"][
"workflowId"].should.equal("uid-abcd1234")
wfe["executionInfo"]["executionStatus"].should.equal("OPEN")
@ -79,10 +84,12 @@ def test_describe_non_existent_workflow_execution():
@mock_swf_deprecated
def test_get_workflow_execution_history():
conn = setup_swf_environment()
hsh = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
hsh = conn.start_workflow_execution(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
run_id = hsh["runId"]
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", run_id, "uid-abcd1234")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
@ -90,7 +97,8 @@ def test_get_workflow_execution_history():
@mock_swf_deprecated
def test_get_workflow_execution_history_with_reverse_order():
conn = setup_swf_environment()
hsh = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
hsh = conn.start_workflow_execution(
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
run_id = hsh["runId"]
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234",
@ -191,7 +199,8 @@ def test_terminate_workflow_execution():
run_id=run_id)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", run_id, "uid-abcd1234")
evt = resp["events"][-1]
evt["eventType"].should.equal("WorkflowExecutionTerminated")
attrs = evt["workflowExecutionTerminatedEventAttributes"]

View file

@ -49,8 +49,10 @@ def test_list_workflow_types():
conn.register_workflow_type("test-domain", "c-test-workflow", "v1.0")
all_workflow_types = conn.list_workflow_types("test-domain", "REGISTERED")
names = [activity_type["workflowType"]["name"] for activity_type in all_workflow_types["typeInfos"]]
names.should.equal(["a-test-workflow", "b-test-workflow", "c-test-workflow"])
names = [activity_type["workflowType"]["name"]
for activity_type in all_workflow_types["typeInfos"]]
names.should.equal(
["a-test-workflow", "b-test-workflow", "c-test-workflow"])
@mock_swf_deprecated
@ -63,8 +65,10 @@ def test_list_workflow_types_reverse_order():
all_workflow_types = conn.list_workflow_types("test-domain", "REGISTERED",
reverse_order=True)
names = [activity_type["workflowType"]["name"] for activity_type in all_workflow_types["typeInfos"]]
names.should.equal(["c-test-workflow", "b-test-workflow", "a-test-workflow"])
names = [activity_type["workflowType"]["name"]
for activity_type in all_workflow_types["typeInfos"]]
names.should.equal(
["c-test-workflow", "b-test-workflow", "a-test-workflow"])
# DeprecateWorkflowType endpoint
@ -111,10 +115,12 @@ def test_describe_workflow_type():
conn.register_workflow_type("test-domain", "test-workflow", "v1.0",
task_list="foo", default_child_policy="TERMINATE")
actype = conn.describe_workflow_type("test-domain", "test-workflow", "v1.0")
actype = conn.describe_workflow_type(
"test-domain", "test-workflow", "v1.0")
actype["configuration"]["defaultTaskList"]["name"].should.equal("foo")
actype["configuration"]["defaultChildPolicy"].should.equal("TERMINATE")
actype["configuration"].keys().should_not.contain("defaultTaskStartToCloseTimeout")
actype["configuration"].keys().should_not.contain(
"defaultTaskStartToCloseTimeout")
infos = actype["typeInfo"]
infos["workflowType"]["name"].should.equal("test-workflow")
infos["workflowType"]["version"].should.equal("v1.0")