Run black on moto & test directories.
This commit is contained in:
parent
c820395dbf
commit
96e5b1993d
507 changed files with 52541 additions and 47814 deletions
|
|
@ -16,69 +16,76 @@ from moto.swf.exceptions import (
|
|||
SWFValidationException,
|
||||
SWFDecisionValidationException,
|
||||
)
|
||||
from moto.swf.models import (
|
||||
WorkflowType,
|
||||
)
|
||||
from moto.swf.models import WorkflowType
|
||||
|
||||
|
||||
def test_swf_client_error():
|
||||
ex = SWFClientError("ASpecificType", "error message")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "ASpecificType",
|
||||
"message": "error message"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{"__type": "ASpecificType", "message": "error message"}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_unknown_resource_fault():
|
||||
ex = SWFUnknownResourceFault("type", "detail")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown type: detail"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown type: detail",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_unknown_resource_fault_with_only_one_parameter():
|
||||
ex = SWFUnknownResourceFault("foo bar baz")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown foo bar baz"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown foo bar baz",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_domain_already_exists_fault():
|
||||
ex = SWFDomainAlreadyExistsFault("domain-name")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DomainAlreadyExistsFault",
|
||||
"message": "domain-name"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DomainAlreadyExistsFault",
|
||||
"message": "domain-name",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_domain_deprecated_fault():
|
||||
ex = SWFDomainDeprecatedFault("domain-name")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DomainDeprecatedFault",
|
||||
"message": "domain-name"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DomainDeprecatedFault",
|
||||
"message": "domain-name",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_serialization_exception():
|
||||
ex = SWFSerializationException("value")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#SerializationException",
|
||||
"message": "class java.lang.Foo can not be converted to an String (not a real SWF exception ; happened on: value)"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#SerializationException",
|
||||
"message": "class java.lang.Foo can not be converted to an String (not a real SWF exception ; happened on: value)",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_type_already_exists_fault():
|
||||
|
|
@ -86,10 +93,12 @@ def test_swf_type_already_exists_fault():
|
|||
ex = SWFTypeAlreadyExistsFault(wft)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#TypeAlreadyExistsFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#TypeAlreadyExistsFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_type_deprecated_fault():
|
||||
|
|
@ -97,51 +106,65 @@ def test_swf_type_deprecated_fault():
|
|||
ex = SWFTypeDeprecatedFault(wft)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#TypeDeprecatedFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#TypeDeprecatedFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_workflow_execution_already_started_fault():
|
||||
ex = SWFWorkflowExecutionAlreadyStartedFault()
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#WorkflowExecutionAlreadyStartedFault",
|
||||
'message': 'Already Started',
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#WorkflowExecutionAlreadyStartedFault",
|
||||
"message": "Already Started",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_default_undefined_fault():
|
||||
ex = SWFDefaultUndefinedFault("execution_start_to_close_timeout")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DefaultUndefinedFault",
|
||||
"message": "executionStartToCloseTimeout",
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DefaultUndefinedFault",
|
||||
"message": "executionStartToCloseTimeout",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_validation_exception():
|
||||
ex = SWFValidationException("Invalid token")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazon.coral.validate#ValidationException",
|
||||
"message": "Invalid token",
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazon.coral.validate#ValidationException",
|
||||
"message": "Invalid token",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_decision_validation_error():
|
||||
ex = SWFDecisionValidationException([
|
||||
{"type": "null_value",
|
||||
"where": "decisions.1.member.startTimerDecisionAttributes.startToFireTimeout"},
|
||||
{"type": "bad_decision_type",
|
||||
"value": "FooBar",
|
||||
"where": "decisions.1.member.decisionType",
|
||||
"possible_values": "Foo, Bar, Baz"},
|
||||
])
|
||||
ex = SWFDecisionValidationException(
|
||||
[
|
||||
{
|
||||
"type": "null_value",
|
||||
"where": "decisions.1.member.startTimerDecisionAttributes.startToFireTimeout",
|
||||
},
|
||||
{
|
||||
"type": "bad_decision_type",
|
||||
"value": "FooBar",
|
||||
"where": "decisions.1.member.decisionType",
|
||||
"possible_values": "Foo, Bar, Baz",
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
ex.error_type.should.equal("com.amazon.coral.validate#ValidationException")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue