Add checks for *DecisionAttributes within RespondDecisionTaskCompleted
This commit is contained in:
parent
507351612e
commit
558b84fb6a
6 changed files with 169 additions and 7 deletions
|
|
@ -191,3 +191,42 @@ def test_respond_decision_task_completed_with_invalid_decision_type():
|
|||
SWFDecisionValidationException,
|
||||
r"Value 'BadDecisionType' at 'decisions.1.member.decisionType'"
|
||||
)
|
||||
|
||||
@mock_swf
|
||||
def test_respond_decision_task_completed_with_missing_attributes():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [
|
||||
{
|
||||
"decisionType": "should trigger even with incorrect decision type",
|
||||
"startTimerDecisionAttributes": {}
|
||||
},
|
||||
]
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token, decisions=decisions
|
||||
).should.throw(
|
||||
SWFDecisionValidationException,
|
||||
r"Value null at 'decisions.1.member.startTimerDecisionAttributes.timerId' " \
|
||||
r"failed to satisfy constraint: Member must not be null"
|
||||
)
|
||||
|
||||
@mock_swf
|
||||
def test_respond_decision_task_completed_with_missing_attributes_totally():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [
|
||||
{ "decisionType": "StartTimer" },
|
||||
]
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token, decisions=decisions
|
||||
).should.throw(
|
||||
SWFDecisionValidationException,
|
||||
r"Value null at 'decisions.1.member.startTimerDecisionAttributes.timerId' " \
|
||||
r"failed to satisfy constraint: Member must not be null"
|
||||
)
|
||||
|
|
|
|||
11
tests/test_swf/test_utils.py
Normal file
11
tests/test_swf/test_utils.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from sure import expect
|
||||
from moto.swf.utils import decapitalize
|
||||
|
||||
def test_decapitalize():
|
||||
cases = {
|
||||
"fooBar": "fooBar",
|
||||
"FooBar": "fooBar",
|
||||
"FOO BAR": "fOO BAR",
|
||||
}
|
||||
for before, after in cases.iteritems():
|
||||
decapitalize(before).should.equal(after)
|
||||
Loading…
Add table
Add a link
Reference in a new issue