From b6d7704b23caa1edf340c0a93abeaaf45a0c7d49 Mon Sep 17 00:00:00 2001 From: Jakub Musko Date: Thu, 18 Feb 2021 19:04:12 +0100 Subject: [PATCH] Update stackset create operation to correctly return the resource's ID. (#3709) * Update stackset create operation to correctly return the resource's ID. * Add test confirming create_stack_set response. --- moto/cloudformation/responses.py | 4 ++-- .../test_cloudformation_stack_crud_boto3.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/moto/cloudformation/responses.py b/moto/cloudformation/responses.py index e9cb35920..c91af0e38 100644 --- a/moto/cloudformation/responses.py +++ b/moto/cloudformation/responses.py @@ -438,7 +438,7 @@ class CloudFormationResponse(BaseResponse): return json.dumps( { "CreateStackSetResponse": { - "CreateStackSetResult": {"StackSetId": stackset.stackset_id} + "CreateStackSetResult": {"StackSetId": stackset.id} } } ) @@ -926,7 +926,7 @@ LIST_EXPORTS_RESPONSE = """ - {{ stackset.stackset_id }} + {{ stackset.id }} f457258c-391d-41d1-861f-example diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py index 1e7a52fa1..977b70833 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py +++ b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py @@ -603,13 +603,14 @@ def test_boto3_delete_stack_set(): @mock_cloudformation def test_boto3_create_stack_set(): cf_conn = boto3.client("cloudformation", region_name="us-east-1") - cf_conn.create_stack_set( + response = cf_conn.create_stack_set( StackSetName="test_stack_set", TemplateBody=dummy_template_json ) cf_conn.describe_stack_set(StackSetName="test_stack_set")["StackSet"][ "TemplateBody" ].should.equal(dummy_template_json) + response["StackSetId"].should_not.be.empty @mock_cloudformation