How to use deprecate_workflow_type method in localstack

Best Python code snippet using localstack_python

test_registration.py

Source:test_registration.py Github

copy

Full Screen

...19 client.register_domain(name="spam", workflowExecutionRetentionPeriodInDays="2")20 client.register_workflow_type(domain="spam", name="foo", version="1.0")21 client.register_workflow_type(domain="spam", name="foo", version="1.1")22 client.register_workflow_type(domain="spam", name="bar", version="0.42")23 client.deprecate_workflow_type(24 domain="spam", workflowType={"name": "foo", "version": "1.0"}25 )26 # Run function27 res = seddy_registration.list_workflows("spam", client)28 assert res == {("foo", "1.0"): False, ("foo", "1.1"): True, ("bar", "0.42"): True}29@moto.mock_swf30def test_register_workflow():31 """Test workflow registration."""32 # Setup environment33 client = boto3.client("swf", region_name="us-east-1")34 client.register_domain(name="spam", workflowExecutionRetentionPeriodInDays="2")35 # Build input36 registration = seddy_decisions.Registration(37 task_timeout="NONE",38 execution_timeout=60,39 task_list="eggs",40 task_priority=2,41 child_policy=seddy_decisions.ChildPolicy.TERMINATE,42 lambda_role="arn:aws:iam::spam:role/eggs",43 )44 workflow = Workflow("foo", "0.42", "A workflow.", registration)45 # Run function46 seddy_registration.register_workflow(workflow, "spam", client)47 # Check registered workflow48 workflow_info = client.describe_workflow_type(49 domain="spam", workflowType={"name": "foo", "version": "0.42"}50 )51 assert workflow_info["typeInfo"]["status"] == "REGISTERED"52 assert workflow_info["typeInfo"]["description"] == "A workflow."53 cfg = workflow_info["configuration"]54 assert cfg["defaultTaskStartToCloseTimeout"] == "NONE"55 assert cfg["defaultExecutionStartToCloseTimeout"] == "60"56 assert cfg["defaultTaskList"] == {"name": "eggs"}57 assert cfg["defaultTaskPriority"] == "2"58 assert cfg["defaultChildPolicy"] == "TERMINATE"59 assert cfg["defaultLambdaRole"] == "arn:aws:iam::spam:role/eggs"60@moto.mock_swf61def test_deprecate_workflow():62 """Test workflow deprecation."""63 # Setup environment64 client = boto3.client("swf", region_name="us-east-1")65 client.register_domain(name="spam", workflowExecutionRetentionPeriodInDays="2")66 client.register_workflow_type(domain="spam", name="foo", version="0.42")67 # Build input68 workflow = Workflow("foo", "0.42", "A workflow.")69 # Run function70 seddy_registration.deprecate_workflow(workflow, "spam", client)71 # Check registered workflow72 workflow_info = client.describe_workflow_type(73 domain="spam", workflowType={"name": "foo", "version": "0.42"}74 )75 assert workflow_info["typeInfo"]["status"] == "DEPRECATED"76@moto.mock_swf77def test_undeprecate_workflow():78 """Test workflow undeprecation."""79 # Setup environment80 client = boto3.client("swf", region_name="us-east-1")81 client.register_domain(name="spam", workflowExecutionRetentionPeriodInDays="2")82 client.register_workflow_type(domain="spam", name="foo", version="0.42")83 client.deprecate_workflow_type(84 domain="spam", workflowType={"name": "foo", "version": "0.42"}85 )86 # Build input87 workflow = Workflow("foo", "0.42", "A workflow.")88 # Run function89 seddy_registration.undeprecate_workflow(workflow, "spam", client)90 # Check registered workflow91 workflow_info = client.describe_workflow_type(92 domain="spam", workflowType={"name": "foo", "version": "0.42"}93 )94 assert workflow_info["typeInfo"]["status"] == "REGISTERED"95@moto.mock_swf96def test_register_workflows():97 """Test workflows registration syncing."""98 # Setup environment99 client = boto3.client("swf", region_name="us-east-1")100 client.register_domain(name="spam", workflowExecutionRetentionPeriodInDays="2")101 client.register_workflow_type(domain="spam", name="foo", version="1.0")102 client.register_workflow_type(domain="spam", name="foo", version="1.1")103 client.register_workflow_type(domain="spam", name="bar", version="0.42")104 client.register_workflow_type(domain="spam", name="bar", version="0.43")105 client.register_workflow_type(domain="spam", name="yay", version="0.17")106 client.register_workflow_type(domain="spam", name="yay", version="0.18")107 client.deprecate_workflow_type(108 domain="spam", workflowType={"name": "foo", "version": "1.0"}109 )110 client.deprecate_workflow_type(111 domain="spam", workflowType={"name": "bar", "version": "0.42"}112 )113 client.deprecate_workflow_type(114 domain="spam", workflowType={"name": "yay", "version": "0.17"}115 )116 client_patch = mock.patch.object(boto3, "client", lambda x, **_: {"swf": client}[x])117 # Build input118 workflows = [119 Workflow("foo", "1.0", registration=seddy_decisions.Registration(active=False)),120 Workflow("foo", "1.1", registration=seddy_decisions.Registration(active=False)),121 Workflow("foo", "1.2", registration=seddy_decisions.Registration(active=True)),122 Workflow("bar", "0.42", registration=seddy_decisions.Registration(active=True)),123 Workflow("bar", "0.43", registration=seddy_decisions.Registration(active=True)),124 Workflow("bar", "0.44", "", seddy_decisions.Registration(active=False)),125 ]126 # Build expectation127 exp_registered_workflow_types = [...

Full Screen

Full Screen

test_workflow_types.py

Source:test_workflow_types.py Github

copy

Full Screen

...60 ]61 names.should.equal(["c-test-workflow", "b-test-workflow", "a-test-workflow"])62# DeprecateWorkflowType endpoint63@mock_swf_deprecated64def test_deprecate_workflow_type():65 conn = boto.connect_swf("the_key", "the_secret")66 conn.register_domain("test-domain", "60")67 conn.register_workflow_type("test-domain", "test-workflow", "v1.0")68 conn.deprecate_workflow_type("test-domain", "test-workflow", "v1.0")69 actypes = conn.list_workflow_types("test-domain", "DEPRECATED")70 actype = actypes["typeInfos"][0]71 actype["workflowType"]["name"].should.equal("test-workflow")72 actype["workflowType"]["version"].should.equal("v1.0")73@mock_swf_deprecated74def test_deprecate_already_deprecated_workflow_type():75 conn = boto.connect_swf("the_key", "the_secret")76 conn.register_domain("test-domain", "60")77 conn.register_workflow_type("test-domain", "test-workflow", "v1.0")78 conn.deprecate_workflow_type("test-domain", "test-workflow", "v1.0")79 conn.deprecate_workflow_type.when.called_with(80 "test-domain", "test-workflow", "v1.0"81 ).should.throw(SWFResponseError)82@mock_swf_deprecated83def test_deprecate_non_existent_workflow_type():84 conn = boto.connect_swf("the_key", "the_secret")85 conn.register_domain("test-domain", "60")86 conn.deprecate_workflow_type.when.called_with(87 "test-domain", "non-existent", "v1.0"88 ).should.throw(SWFResponseError)89# UndeprecateWorkflowType endpoint90@mock_swf91def test_undeprecate_workflow_type():92 client = boto3.client("swf", region_name="us-east-1")93 client.register_domain(94 name="test-domain", workflowExecutionRetentionPeriodInDays="60"95 )96 client.register_workflow_type(97 domain="test-domain", name="test-workflow", version="v1.0"98 )99 client.deprecate_workflow_type(100 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}101 )102 client.undeprecate_workflow_type(103 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}104 )105 resp = client.describe_workflow_type(106 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}107 )108 resp["typeInfo"]["status"].should.equal("REGISTERED")109@mock_swf110def test_undeprecate_already_undeprecated_workflow_type():111 client = boto3.client("swf", region_name="us-east-1")112 client.register_domain(113 name="test-domain", workflowExecutionRetentionPeriodInDays="60"114 )115 client.register_workflow_type(116 domain="test-domain", name="test-workflow", version="v1.0"117 )118 client.deprecate_workflow_type(119 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}120 )121 client.undeprecate_workflow_type(122 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}123 )124 client.undeprecate_workflow_type.when.called_with(125 domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}126 ).should.throw(ClientError)127@mock_swf128def test_undeprecate_never_deprecated_workflow_type():129 client = boto3.client("swf", region_name="us-east-1")130 client.register_domain(131 name="test-domain", workflowExecutionRetentionPeriodInDays="60"132 )133 client.register_workflow_type(134 domain="test-domain", name="test-workflow", version="v1.0"135 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful