How to use the moto.mock_swf_deprecated function in moto

To help you get started, we’ve selected a few moto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spulec / moto / tests / test_swf / responses / test_activity_types.py View on Github external
@mock_swf_deprecated
def test_deprecate_activity_type():
    conn = boto.connect_swf("the_key", "the_secret")
    conn.register_domain("test-domain", "60")
    conn.register_activity_type("test-domain", "test-activity", "v1.0")
    conn.deprecate_activity_type("test-domain", "test-activity", "v1.0")

    actypes = conn.list_activity_types("test-domain", "DEPRECATED")
    actype = actypes["typeInfos"][0]
    actype["activityType"]["name"].should.equal("test-activity")
    actype["activityType"]["version"].should.equal("v1.0")
github spulec / moto / tests / test_swf / responses / test_workflow_types.py View on Github external
@mock_swf_deprecated
def test_deprecate_workflow_type():
    conn = boto.connect_swf("the_key", "the_secret")
    conn.register_domain("test-domain", "60")
    conn.register_workflow_type("test-domain", "test-workflow", "v1.0")
    conn.deprecate_workflow_type("test-domain", "test-workflow", "v1.0")

    actypes = conn.list_workflow_types("test-domain", "DEPRECATED")
    actype = actypes["typeInfos"][0]
    actype["workflowType"]["name"].should.equal("test-workflow")
    actype["workflowType"]["version"].should.equal("v1.0")
github spulec / moto / tests / test_swf / responses / test_decision_tasks.py View on Github external
@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")
    task_token = resp["taskToken"]

    decisions = [
        {
            "decisionType": "FailWorkflowExecution",
            "failWorkflowExecutionDecisionAttributes": {
                "reason": "my rules",
                "details": "foo",
            },
        }
    ]
    resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
    resp.should.be.none
github spulec / moto / tests / test_swf / responses / test_workflow_executions.py View on Github external
@mock_swf_deprecated
def test_terminate_workflow_execution_with_wrong_workflow_or_run_id():
    conn = setup_swf_environment()
    run_id = conn.start_workflow_execution(
        "test-domain", "uid-abcd1234", "test-workflow", "v1.0"
    )["runId"]

    # terminate workflow execution
    conn.terminate_workflow_execution("test-domain", "uid-abcd1234")

    # already closed, with run_id
    conn.terminate_workflow_execution.when.called_with(
        "test-domain", "uid-abcd1234", run_id=run_id
    ).should.throw(
        SWFResponseError, "WorkflowExecution=[workflowId=uid-abcd1234, runId="
    )
github spulec / moto / tests / test_swf / responses / test_decision_tasks.py View on Github external
@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")
    task_token = resp["taskToken"]

    # 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

    conn.respond_decision_task_completed.when.called_with(task_token).should.throw(
        SWFResponseError
    )
github spulec / moto / tests / test_swf / responses / test_domains.py View on Github external
@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")

    conn.register_domain.when.called_with(
        "test-domain", "60", description="A test domain"
    ).should.throw(SWFResponseError)
github spulec / moto / tests / test_swf / responses / test_activity_types.py View on Github external
@mock_swf_deprecated
def test_register_activity_type():
    conn = boto.connect_swf("the_key", "the_secret")
    conn.register_domain("test-domain", "60")
    conn.register_activity_type("test-domain", "test-activity", "v1.0")

    types = conn.list_activity_types("test-domain", "REGISTERED")
    actype = types["typeInfos"][0]
    actype["activityType"]["name"].should.equal("test-activity")
    actype["activityType"]["version"].should.equal("v1.0")
github spulec / moto / tests / test_swf / responses / test_workflow_types.py View on Github external
@mock_swf_deprecated
def test_register_workflow_type():
    conn = boto.connect_swf("the_key", "the_secret")
    conn.register_domain("test-domain", "60")
    conn.register_workflow_type("test-domain", "test-workflow", "v1.0")

    types = conn.list_workflow_types("test-domain", "REGISTERED")
    actype = types["typeInfos"][0]
    actype["workflowType"]["name"].should.equal("test-workflow")
    actype["workflowType"]["version"].should.equal("v1.0")
github spulec / moto / tests / test_swf / responses / test_activity_types.py View on Github external
@mock_swf_deprecated
def test_deprecate_already_deprecated_activity_type():
    conn = boto.connect_swf("the_key", "the_secret")
    conn.register_domain("test-domain", "60")
    conn.register_activity_type("test-domain", "test-activity", "v1.0")
    conn.deprecate_activity_type("test-domain", "test-activity", "v1.0")

    conn.deprecate_activity_type.when.called_with(
        "test-domain", "test-activity", "v1.0"
    ).should.throw(SWFResponseError)
github spulec / moto / tests / test_swf / responses / test_timeouts.py View on Github external
@mock_swf_deprecated
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"
        ]
        conn.respond_decision_task_completed(
            decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
        )
        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"