Merge pull request #2783 from EpicWink/swf-undeprecate

Add SWF domain and type undeprecation
This commit is contained in:
Bert Blommers 2020-03-06 08:37:36 +00:00 committed by GitHub
commit 15444bd4f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 238 additions and 3 deletions

View file

@ -1,8 +1,11 @@
import boto
from boto.swf.exceptions import SWFResponseError
import boto3
from botocore.exceptions import ClientError
import sure # noqa
from moto import mock_swf_deprecated
from moto import mock_swf
# RegisterActivityType endpoint
@ -110,6 +113,77 @@ def test_deprecate_non_existent_activity_type():
).should.throw(SWFResponseError)
# DeprecateActivityType endpoint
@mock_swf
def test_undeprecate_activity_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_activity_type(
domain="test-domain", name="test-activity", version="v1.0"
)
client.deprecate_activity_type(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
)
client.undeprecate_activity_type(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
)
resp = client.describe_activity_type(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
)
resp["typeInfo"]["status"].should.equal("REGISTERED")
@mock_swf
def test_undeprecate_already_undeprecated_activity_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_activity_type(
domain="test-domain", name="test-activity", version="v1.0"
)
client.deprecate_activity_type(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
)
client.undeprecate_activity_type(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
)
client.undeprecate_activity_type.when.called_with(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
).should.throw(ClientError)
@mock_swf
def test_undeprecate_never_deprecated_activity_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_activity_type(
domain="test-domain", name="test-activity", version="v1.0"
)
client.undeprecate_activity_type.when.called_with(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
).should.throw(ClientError)
@mock_swf
def test_undeprecate_non_existent_activity_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.undeprecate_activity_type.when.called_with(
domain="test-domain", activityType={"name": "test-activity", "version": "v1.0"}
).should.throw(ClientError)
# DescribeActivityType endpoint
@mock_swf_deprecated
def test_describe_activity_type():

View file

@ -1,8 +1,11 @@
import boto
from boto.swf.exceptions import SWFResponseError
import boto3
from botocore.exceptions import ClientError
import sure # noqa
from moto import mock_swf_deprecated
from moto import mock_swf
# RegisterDomain endpoint
@ -94,6 +97,56 @@ def test_deprecate_non_existent_domain():
)
# UndeprecateDomain endpoint
@mock_swf
def test_undeprecate_domain():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.deprecate_domain(name="test-domain")
client.undeprecate_domain(name="test-domain")
resp = client.describe_domain(name="test-domain")
resp["domainInfo"]["status"].should.equal("REGISTERED")
@mock_swf
def test_undeprecate_already_undeprecated_domain():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.deprecate_domain(name="test-domain")
client.undeprecate_domain(name="test-domain")
client.undeprecate_domain.when.called_with(name="test-domain").should.throw(
ClientError
)
@mock_swf
def test_undeprecate_never_deprecated_domain():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.undeprecate_domain.when.called_with(name="test-domain").should.throw(
ClientError
)
@mock_swf
def test_undeprecate_non_existent_domain():
client = boto3.client("swf", region_name="us-east-1")
client.undeprecate_domain.when.called_with(name="non-existent").should.throw(
ClientError
)
# DescribeDomain endpoint
@mock_swf_deprecated
def test_describe_domain():

View file

@ -5,6 +5,7 @@ import boto3
from moto import mock_swf_deprecated
from moto import mock_swf
from boto.swf.exceptions import SWFResponseError
from botocore.exceptions import ClientError
# RegisterWorkflowType endpoint
@ -112,6 +113,77 @@ def test_deprecate_non_existent_workflow_type():
).should.throw(SWFResponseError)
# UndeprecateWorkflowType endpoint
@mock_swf
def test_undeprecate_workflow_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_workflow_type(
domain="test-domain", name="test-workflow", version="v1.0"
)
client.deprecate_workflow_type(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
)
client.undeprecate_workflow_type(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
)
resp = client.describe_workflow_type(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
)
resp["typeInfo"]["status"].should.equal("REGISTERED")
@mock_swf
def test_undeprecate_already_undeprecated_workflow_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_workflow_type(
domain="test-domain", name="test-workflow", version="v1.0"
)
client.deprecate_workflow_type(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
)
client.undeprecate_workflow_type(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
)
client.undeprecate_workflow_type.when.called_with(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
).should.throw(ClientError)
@mock_swf
def test_undeprecate_never_deprecated_workflow_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.register_workflow_type(
domain="test-domain", name="test-workflow", version="v1.0"
)
client.undeprecate_workflow_type.when.called_with(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
).should.throw(ClientError)
@mock_swf
def test_undeprecate_non_existent_workflow_type():
client = boto3.client("swf", region_name="us-east-1")
client.register_domain(
name="test-domain", workflowExecutionRetentionPeriodInDays="60"
)
client.undeprecate_workflow_type.when.called_with(
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
).should.throw(ClientError)
# DescribeWorkflowType endpoint
@mock_swf_deprecated
def test_describe_workflow_type():