Add show_resource function to Magnum resources (8)

AWS resources will not be changed as they do not support additional
attributes. So 'show' attribute will be presented in their schemas, but
will return always None.

This patch adds show_resource method for heat (magnum) resources:
 - baymodel

Change-Id: I73bb82477e7424b914b2132dd1b9aba2e4c5c7d2
This commit is contained in:
Oleksii Chuprykov 2015-07-31 14:59:59 +03:00
parent 7cc74c26a1
commit 12b6820922
2 changed files with 12 additions and 0 deletions

View File

@ -117,6 +117,8 @@ class BayModel(resource.Resource):
default_client_name = 'magnum'
entity = 'baymodels'
def handle_create(self):
args = {
'name': self.properties[self.NAME],

View File

@ -43,6 +43,11 @@ magnum_template = '''
RESOURCE_TYPE = 'OS::Magnum::BayModel'
class FakeBayModel(object):
def __init__(self):
self.to_dict = lambda: {'attr': 'val'}
class TestMagnumBayModel(common.HeatTestCase):
def setUp(self):
super(TestMagnumBayModel, self).setUp()
@ -84,3 +89,8 @@ class TestMagnumBayModel(common.HeatTestCase):
mapping = baymodel.resource_mapping()
self.assertEqual(1, len(mapping))
self.assertEqual(baymodel.BayModel, mapping[RESOURCE_TYPE])
def test_show_resource(self):
bm = self._create_resource('bm', self.rsrc_defn, self.stack)
self.client.baymodels.get.return_value = FakeBayModel()
self.assertEqual({'attr': 'val'}, bm.FnGetAtt('show'))