Move setup_workflow() test function in test utils
This commit is contained in:
parent
be71909a8c
commit
a0e484fa6d
@ -9,24 +9,7 @@ from moto.swf.exceptions import (
|
|||||||
SWFDecisionValidationException,
|
SWFDecisionValidationException,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..utils import mock_basic_workflow_type
|
from ..utils import setup_workflow
|
||||||
|
|
||||||
|
|
||||||
@mock_swf
|
|
||||||
def setup_workflow():
|
|
||||||
conn = boto.connect_swf("the_key", "the_secret")
|
|
||||||
conn.register_domain("test-domain", "60", description="A test domain")
|
|
||||||
conn = mock_basic_workflow_type("test-domain", conn)
|
|
||||||
conn.register_activity_type(
|
|
||||||
"test-domain", "test-activity", "v1.1",
|
|
||||||
default_task_heartbeat_timeout="600",
|
|
||||||
default_task_schedule_to_close_timeout="600",
|
|
||||||
default_task_schedule_to_start_timeout="600",
|
|
||||||
default_task_start_to_close_timeout="600",
|
|
||||||
)
|
|
||||||
wfe = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
|
||||||
conn.run_id = wfe["runId"]
|
|
||||||
return conn
|
|
||||||
|
|
||||||
|
|
||||||
# PollForDecisionTask endpoint
|
# PollForDecisionTask endpoint
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
import boto
|
||||||
|
|
||||||
|
from moto import mock_swf
|
||||||
from moto.swf.models import (
|
from moto.swf.models import (
|
||||||
ActivityType,
|
ActivityType,
|
||||||
Domain,
|
Domain,
|
||||||
@ -38,3 +41,21 @@ def make_workflow_execution(**kwargs):
|
|||||||
domain.add_type(ActivityType("test-activity", "v1.1"))
|
domain.add_type(ActivityType("test-activity", "v1.1"))
|
||||||
wft = get_basic_workflow_type()
|
wft = get_basic_workflow_type()
|
||||||
return WorkflowExecution(domain, wft, "ab1234", **kwargs)
|
return WorkflowExecution(domain, wft, "ab1234", **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
# Setup a complete example workflow and return the connection object
|
||||||
|
@mock_swf
|
||||||
|
def setup_workflow():
|
||||||
|
conn = boto.connect_swf("the_key", "the_secret")
|
||||||
|
conn.register_domain("test-domain", "60", description="A test domain")
|
||||||
|
conn = mock_basic_workflow_type("test-domain", conn)
|
||||||
|
conn.register_activity_type(
|
||||||
|
"test-domain", "test-activity", "v1.1",
|
||||||
|
default_task_heartbeat_timeout="600",
|
||||||
|
default_task_schedule_to_close_timeout="600",
|
||||||
|
default_task_schedule_to_start_timeout="600",
|
||||||
|
default_task_start_to_close_timeout="600",
|
||||||
|
)
|
||||||
|
wfe = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||||
|
conn.run_id = wfe["runId"]
|
||||||
|
return conn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user