Return the deleted stacks in the list stacks call
This matches the behaviour of the AWS API.
This commit is contained in:
parent
ed861ecae1
commit
2d554cd098
@ -223,7 +223,11 @@ class CloudFormationBackend(BaseBackend):
|
|||||||
return list(stacks)
|
return list(stacks)
|
||||||
|
|
||||||
def list_stacks(self):
|
def list_stacks(self):
|
||||||
return self.stacks.values()
|
return [
|
||||||
|
v for v in self.stacks.values()
|
||||||
|
] + [
|
||||||
|
v for v in self.deleted_stacks.values()
|
||||||
|
]
|
||||||
|
|
||||||
def get_stack(self, name_or_stack_id):
|
def get_stack(self, name_or_stack_id):
|
||||||
all_stacks = dict(self.deleted_stacks, **self.stacks)
|
all_stacks = dict(self.deleted_stacks, **self.stacks)
|
||||||
|
@ -532,6 +532,21 @@ def test_delete_stack_by_name():
|
|||||||
cf_conn.describe_stacks()['Stacks'].should.have.length_of(0)
|
cf_conn.describe_stacks()['Stacks'].should.have.length_of(0)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_cloudformation
|
||||||
|
def test_delete_stack():
|
||||||
|
cf = boto3.client('cloudformation', region_name='us-east-1')
|
||||||
|
cf.create_stack(
|
||||||
|
StackName="test_stack",
|
||||||
|
TemplateBody=dummy_template_json,
|
||||||
|
)
|
||||||
|
|
||||||
|
cf.delete_stack(
|
||||||
|
StackName="test_stack",
|
||||||
|
)
|
||||||
|
stacks = cf.list_stacks()
|
||||||
|
assert stacks['StackSummaries'][0]['StackStatus'] == 'DELETE_COMPLETE'
|
||||||
|
|
||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
def test_describe_deleted_stack():
|
def test_describe_deleted_stack():
|
||||||
cf_conn = boto3.client('cloudformation', region_name='us-east-1')
|
cf_conn = boto3.client('cloudformation', region_name='us-east-1')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user