Testing new version of decorator.
This commit is contained in:
parent
d3df810065
commit
fde721bed7
123 changed files with 2740 additions and 1114 deletions
|
|
@ -1,14 +1,14 @@
|
|||
from boto.swf.exceptions import SWFResponseError
|
||||
from freezegun import freeze_time
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
from moto.swf import swf_backend
|
||||
|
||||
from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
|
||||
|
||||
# PollForActivityTask endpoint
|
||||
@mock_swf
|
||||
@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"]
|
||||
|
|
@ -26,14 +26,14 @@ def test_poll_for_activity_task_when_one():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_poll_for_activity_task_when_none():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_activity_task("test-domain", "activity-task-list")
|
||||
resp.should.equal({"startedEventId": 0})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_poll_for_activity_task_on_non_existent_queue():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_activity_task("test-domain", "non-existent-queue")
|
||||
|
|
@ -41,7 +41,7 @@ def test_poll_for_activity_task_on_non_existent_queue():
|
|||
|
||||
|
||||
# CountPendingActivityTasks endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_count_pending_activity_tasks():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
|
|
@ -53,7 +53,7 @@ def test_count_pending_activity_tasks():
|
|||
resp.should.equal({"count": 1, "truncated": False})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_count_pending_decision_tasks_on_non_existent_task_list():
|
||||
conn = setup_workflow()
|
||||
resp = conn.count_pending_activity_tasks("test-domain", "non-existent")
|
||||
|
|
@ -61,7 +61,7 @@ def test_count_pending_decision_tasks_on_non_existent_task_list():
|
|||
|
||||
|
||||
# RespondActivityTaskCompleted endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_completed():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
|
|
@ -80,7 +80,7 @@ def test_respond_activity_task_completed():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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"]
|
||||
|
|
@ -99,7 +99,7 @@ def test_respond_activity_task_completed_on_closed_workflow_execution():
|
|||
).should.throw(SWFResponseError, "WorkflowExecution=")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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"]
|
||||
|
|
@ -116,7 +116,7 @@ def test_respond_activity_task_completed_with_task_already_completed():
|
|||
|
||||
|
||||
# RespondActivityTaskFailed endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_failed():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
|
|
@ -138,7 +138,7 @@ def test_respond_activity_task_failed():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_completed_with_wrong_token():
|
||||
# NB: we just test ONE failure case for RespondActivityTaskFailed
|
||||
# because the safeguards are shared with RespondActivityTaskCompleted, so
|
||||
|
|
@ -155,7 +155,7 @@ def test_respond_activity_task_completed_with_wrong_token():
|
|||
|
||||
|
||||
# RecordActivityTaskHeartbeat endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_record_activity_task_heartbeat():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
|
|
@ -168,7 +168,7 @@ def test_record_activity_task_heartbeat():
|
|||
resp.should.equal({"cancelRequested": False})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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"]
|
||||
|
|
@ -182,7 +182,7 @@ def test_record_activity_task_heartbeat_with_wrong_token():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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"]
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import boto
|
||||
from boto.swf.exceptions import SWFResponseError
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
|
||||
|
||||
# RegisterActivityType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -17,7 +17,7 @@ def test_register_activity_type():
|
|||
actype["activityType"]["version"].should.equal("v1.0")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_already_existing_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -28,7 +28,7 @@ def test_register_already_existing_activity_type():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_with_wrong_parameter_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -39,7 +39,7 @@ def test_register_with_wrong_parameter_type():
|
|||
|
||||
|
||||
# ListActivityTypes endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_activity_types():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -52,7 +52,7 @@ def test_list_activity_types():
|
|||
names.should.equal(["a-test-activity", "b-test-activity", "c-test-activity"])
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_activity_types_reverse_order():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -67,7 +67,7 @@ def test_list_activity_types_reverse_order():
|
|||
|
||||
|
||||
# DeprecateActivityType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -80,7 +80,7 @@ def test_deprecate_activity_type():
|
|||
actype["activityType"]["version"].should.equal("v1.0")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_already_deprecated_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -92,7 +92,7 @@ def test_deprecate_already_deprecated_activity_type():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_non_existent_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -103,7 +103,7 @@ def test_deprecate_non_existent_activity_type():
|
|||
|
||||
|
||||
# DescribeActivityType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -118,7 +118,7 @@ def test_describe_activity_type():
|
|||
infos["status"].should.equal("REGISTERED")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_non_existent_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
from boto.swf.exceptions import SWFResponseError
|
||||
from freezegun import freeze_time
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
from moto.swf import swf_backend
|
||||
|
||||
from ..utils import setup_workflow
|
||||
|
||||
|
||||
# PollForDecisionTask endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_poll_for_decision_task_when_one():
|
||||
conn = setup_workflow()
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ def test_poll_for_decision_task_when_one():
|
|||
resp["events"][-1]["decisionTaskStartedEventAttributes"]["identity"].should.equal("srv01")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_poll_for_decision_task_when_none():
|
||||
conn = setup_workflow()
|
||||
conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -34,14 +34,14 @@ def test_poll_for_decision_task_when_none():
|
|||
resp.should.equal({"previousStartedEventId": 0, "startedEventId": 0})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_poll_for_decision_task_on_non_existent_queue():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "non-existent-queue")
|
||||
resp.should.equal({"previousStartedEventId": 0, "startedEventId": 0})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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)
|
||||
|
|
@ -50,7 +50,7 @@ def test_poll_for_decision_task_with_reverse_order():
|
|||
|
||||
|
||||
# CountPendingDecisionTasks endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_count_pending_decision_tasks():
|
||||
conn = setup_workflow()
|
||||
conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -58,14 +58,14 @@ def test_count_pending_decision_tasks():
|
|||
resp.should.equal({"count": 1, "truncated": False})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_count_pending_decision_tasks_on_non_existent_task_list():
|
||||
conn = setup_workflow()
|
||||
resp = conn.count_pending_decision_tasks("test-domain", "non-existent")
|
||||
resp.should.equal({"count": 0, "truncated": False})
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_count_pending_decision_tasks_after_decision_completes():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -76,7 +76,7 @@ def test_count_pending_decision_tasks_after_decision_completes():
|
|||
|
||||
|
||||
# RespondDecisionTaskCompleted endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_no_decision():
|
||||
conn = setup_workflow()
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ def test_respond_decision_task_completed_with_no_decision():
|
|||
resp["latestExecutionContext"].should.equal("free-form context")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_wrong_token():
|
||||
conn = setup_workflow()
|
||||
conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -117,7 +117,7 @@ def test_respond_decision_task_completed_with_wrong_token():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_on_close_workflow_execution():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -133,7 +133,7 @@ def test_respond_decision_task_completed_on_close_workflow_execution():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_task_already_completed():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -145,7 +145,7 @@ def test_respond_decision_task_completed_with_task_already_completed():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_complete_workflow_execution():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -170,7 +170,7 @@ def test_respond_decision_task_completed_with_complete_workflow_execution():
|
|||
resp["events"][-1]["workflowExecutionCompletedEventAttributes"]["result"].should.equal("foo bar")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_close_decision_not_last():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -186,7 +186,7 @@ def test_respond_decision_task_completed_with_close_decision_not_last():
|
|||
).should.throw(SWFResponseError, r"Close must be last decision in list")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_invalid_decision_type():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -204,7 +204,7 @@ def test_respond_decision_task_completed_with_invalid_decision_type():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_missing_attributes():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -226,7 +226,7 @@ def test_respond_decision_task_completed_with_missing_attributes():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_missing_attributes_totally():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -245,7 +245,7 @@ def test_respond_decision_task_completed_with_missing_attributes_totally():
|
|||
)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_respond_decision_task_completed_with_fail_workflow_execution():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
|
|
@ -272,7 +272,7 @@ def test_respond_decision_task_completed_with_fail_workflow_execution():
|
|||
attrs["details"].should.equal("foo")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
@freeze_time("2015-01-01 12:00:00")
|
||||
def test_respond_decision_task_completed_with_schedule_activity_task():
|
||||
conn = setup_workflow()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import boto
|
||||
from boto.swf.exceptions import SWFResponseError
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
|
||||
|
||||
# RegisterDomain endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -18,7 +18,7 @@ def test_register_domain():
|
|||
domain["description"].should.equal("A test domain")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_already_existing_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -28,7 +28,7 @@ def test_register_already_existing_domain():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_with_wrong_parameter_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ def test_register_with_wrong_parameter_type():
|
|||
|
||||
|
||||
# ListDomains endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_domains_order():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("b-test-domain", "60")
|
||||
|
|
@ -50,7 +50,7 @@ def test_list_domains_order():
|
|||
names.should.equal(["a-test-domain", "b-test-domain", "c-test-domain"])
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_domains_reverse_order():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("b-test-domain", "60")
|
||||
|
|
@ -63,7 +63,7 @@ def test_list_domains_reverse_order():
|
|||
|
||||
|
||||
# DeprecateDomain endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -75,7 +75,7 @@ def test_deprecate_domain():
|
|||
domain["name"].should.equal("test-domain")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_already_deprecated_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -86,7 +86,7 @@ def test_deprecate_already_deprecated_domain():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_non_existent_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ def test_deprecate_non_existent_domain():
|
|||
|
||||
|
||||
# DescribeDomain endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -108,7 +108,7 @@ def test_describe_domain():
|
|||
domain["domainInfo"]["status"].should.equal("REGISTERED")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_non_existent_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
from freezegun import freeze_time
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
|
||||
from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
|
||||
|
||||
# Activity Task Heartbeat timeout
|
||||
# Default value in workflow helpers: 5 mins
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_activity_task_heartbeat_timeout():
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
conn = setup_workflow()
|
||||
|
|
@ -36,7 +36,7 @@ def test_activity_task_heartbeat_timeout():
|
|||
|
||||
# Decision Task Start to Close timeout
|
||||
# Default value in workflow helpers: 5 mins
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_decision_task_start_to_close_timeout():
|
||||
pass
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
|
|
@ -70,7 +70,7 @@ def test_decision_task_start_to_close_timeout():
|
|||
|
||||
# Workflow Execution Start to Close timeout
|
||||
# Default value in workflow helpers: 2 hours
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_workflow_execution_start_to_close_timeout():
|
||||
pass
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ import sure # noqa
|
|||
# Ensure 'assert_raises' context manager support for Python 2.6
|
||||
import tests.backport_assert_raises # noqa
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
from moto.core.utils import unix_time
|
||||
|
||||
|
||||
# Utils
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def setup_swf_environment():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
|
@ -26,7 +26,7 @@ def setup_swf_environment():
|
|||
|
||||
|
||||
# StartWorkflowExecution endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_start_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ def test_start_workflow_execution():
|
|||
wf.should.contain("runId")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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")
|
||||
|
|
@ -44,7 +44,7 @@ def test_start_already_started_workflow_execution():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_start_workflow_execution_on_deprecated_type():
|
||||
conn = setup_swf_environment()
|
||||
conn.deprecate_workflow_type("test-domain", "test-workflow", "v1.0")
|
||||
|
|
@ -55,7 +55,7 @@ def test_start_workflow_execution_on_deprecated_type():
|
|||
|
||||
|
||||
# DescribeWorkflowExecution endpoint
|
||||
@mock_swf
|
||||
@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")
|
||||
|
|
@ -66,7 +66,7 @@ def test_describe_workflow_execution():
|
|||
wfe["executionInfo"]["executionStatus"].should.equal("OPEN")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_non_existent_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ def test_describe_non_existent_workflow_execution():
|
|||
|
||||
|
||||
# GetWorkflowExecutionHistory endpoint
|
||||
@mock_swf
|
||||
@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")
|
||||
|
|
@ -87,7 +87,7 @@ def test_get_workflow_execution_history():
|
|||
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
|
||||
|
||||
|
||||
@mock_swf
|
||||
@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")
|
||||
|
|
@ -99,7 +99,7 @@ def test_get_workflow_execution_history_with_reverse_order():
|
|||
types.should.equal(["DecisionTaskScheduled", "WorkflowExecutionStarted"])
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_get_workflow_execution_history_on_non_existent_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ def test_get_workflow_execution_history_on_non_existent_workflow_execution():
|
|||
|
||||
|
||||
# ListOpenWorkflowExecutions endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_open_workflow_executions():
|
||||
conn = setup_swf_environment()
|
||||
# One open workflow execution
|
||||
|
|
@ -143,7 +143,7 @@ def test_list_open_workflow_executions():
|
|||
|
||||
|
||||
# ListClosedWorkflowExecutions endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_closed_workflow_executions():
|
||||
conn = setup_swf_environment()
|
||||
# Leave one workflow execution open to make sure it isn't displayed
|
||||
|
|
@ -178,7 +178,7 @@ def test_list_closed_workflow_executions():
|
|||
|
||||
|
||||
# TerminateWorkflowExecution endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_terminate_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
run_id = conn.start_workflow_execution(
|
||||
|
|
@ -200,7 +200,7 @@ def test_terminate_workflow_execution():
|
|||
attrs["cause"].should.equal("OPERATOR_INITIATED")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_terminate_workflow_execution_with_wrong_workflow_or_run_id():
|
||||
conn = setup_swf_environment()
|
||||
run_id = conn.start_workflow_execution(
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import sure
|
||||
import boto
|
||||
|
||||
from moto import mock_swf
|
||||
from moto import mock_swf_deprecated
|
||||
from boto.swf.exceptions import SWFResponseError
|
||||
|
||||
|
||||
# RegisterWorkflowType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -17,7 +18,7 @@ def test_register_workflow_type():
|
|||
actype["workflowType"]["version"].should.equal("v1.0")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_already_existing_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -28,7 +29,7 @@ def test_register_already_existing_workflow_type():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_register_with_wrong_parameter_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -39,7 +40,7 @@ def test_register_with_wrong_parameter_type():
|
|||
|
||||
|
||||
# ListWorkflowTypes endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_workflow_types():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -52,7 +53,7 @@ def test_list_workflow_types():
|
|||
names.should.equal(["a-test-workflow", "b-test-workflow", "c-test-workflow"])
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_list_workflow_types_reverse_order():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -67,7 +68,7 @@ def test_list_workflow_types_reverse_order():
|
|||
|
||||
|
||||
# DeprecateWorkflowType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -80,7 +81,7 @@ def test_deprecate_workflow_type():
|
|||
actype["workflowType"]["version"].should.equal("v1.0")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_already_deprecated_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -92,7 +93,7 @@ def test_deprecate_already_deprecated_workflow_type():
|
|||
).should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_non_existent_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -103,7 +104,7 @@ def test_deprecate_non_existent_workflow_type():
|
|||
|
||||
|
||||
# DescribeWorkflowType endpoint
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
@ -120,7 +121,7 @@ def test_describe_workflow_type():
|
|||
infos["status"].should.equal("REGISTERED")
|
||||
|
||||
|
||||
@mock_swf
|
||||
@mock_swf_deprecated
|
||||
def test_describe_non_existent_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue