def test_get_stack_abandon_data(self):
    tpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Parameters': {'param1': {'Type': 'String'}}, 'Resources': {'A': {'Type': 'GenericResourceType'}, 'B': {'Type': 'GenericResourceType'}}}
    resources = '{"A": {"status": "COMPLETE", "name": "A",\n        "resource_data": {}, "resource_id": null, "action": "INIT",\n        "type": "GenericResourceType", "metadata": {}},\n        "B": {"status": "COMPLETE", "name": "B", "resource_data": {},\n        "resource_id": null, "action": "INIT", "type": "GenericResourceType",\n        "metadata": {}}}'
    env = environment.Environment({'parameters': {'param1': 'test'}})
    self.ctx.tenant_id = '123'
    self.stack = stack.Stack(self.ctx, 'stack_details_test', template.Template(tpl, env=env), tenant_id=self.ctx.tenant_id, stack_user_project_id='234', tags=['tag1', 'tag2'])
    self.stack.store()
    info = self.stack.prepare_abandon()
    self.assertEqual('CREATE', info['action'])
    self.assertIn('id', info)
    self.assertEqual('stack_details_test', info['name'])
    self.assertEqual(json.loads(resources), info['resources'])
    self.assertEqual('IN_PROGRESS', info['status'])
    self.assertEqual(tpl, info['template'])
    self.assertEqual('123', info['project_id'])
    self.assertEqual('234', info['stack_user_project_id'])
    self.assertEqual(env.params, info['environment']['parameters'])
    self.assertEqual(['tag1', 'tag2'], info['tags'])
def test_get_stack_abandon_data(self):
    tpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Parameters': {'param1': {'Type': 'String'}}, 'Resources': {'A': {'Type': 'GenericResourceType'}, 'B': {'Type': 'GenericResourceType'}}}
    resources = '{"A": {"status": "COMPLETE", "name": "A",\n        "resource_data": {}, "resource_id": null, "action": "INIT",\n        "type": "GenericResourceType", "metadata": {}},\n        "B": {"status": "COMPLETE", "name": "B", "resource_data": {},\n        "resource_id": null, "action": "INIT", "type": "GenericResourceType",\n        "metadata": {}}}'
    env = environment.Environment({'parameters': {'param1': 'test'}})
    self.ctx.tenant_id = '123'
    self.stack = stack.Stack(self.ctx, 'stack_details_test', template.Template(tpl, env=env), tenant_id=self.ctx.tenant_id, stack_user_project_id='234', tags=['tag1', 'tag2'])
    self.stack.store()
    info = self.stack.prepare_abandon()
    self.assertEqual('CREATE', info['action'])
    self.assertIn('id', info)
    self.assertEqual('stack_details_test', info['name'])
    self.assertEqual(json.loads(resources), info['resources'])
    self.assertEqual('IN_PROGRESS', info['status'])
    self.assertEqual(tpl, info['template'])
    self.assertEqual('123', info['project_id'])
    self.assertEqual('234', info['stack_user_project_id'])
    self.assertEqual(env.params, info['environment']['parameters'])
    self.assertEqual(['tag1', 'tag2'], info['tags'])