Add test for ResourceDefinition equality
ResourceDefinition objects compare equal if they are generated from equivalent templates. Only the MRO stands between us and disaster (since both superclasses - ResourceDefinitionCore and collections.Mapping - define __eq__ methods), so add a test to confirm that we are getting the correct one. Change-Id: I8181f91f08fd81104fe493539511d6fd129522c8
This commit is contained in:
parent
ecdb1adc67
commit
d662581760
@ -15,6 +15,7 @@ from heat.tests.common import HeatTestCase
|
|||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.engine.cfn import functions as cfn_funcs
|
from heat.engine.cfn import functions as cfn_funcs
|
||||||
|
from heat.engine.hot import functions as hot_funcs
|
||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
from heat.engine import rsrc_defn
|
from heat.engine import rsrc_defn
|
||||||
|
|
||||||
@ -141,6 +142,20 @@ class ResourceDefinitionTest(HeatTestCase):
|
|||||||
|
|
||||||
self.assertEqual(expected_hot, rd.render_hot())
|
self.assertEqual(expected_hot, rd.render_hot())
|
||||||
|
|
||||||
|
def test_template_equality(self):
|
||||||
|
class FakeStack(object):
|
||||||
|
def __init__(self, params):
|
||||||
|
self.parameters = params
|
||||||
|
|
||||||
|
def get_param_defn(value):
|
||||||
|
stack = FakeStack({'Foo': value})
|
||||||
|
param_func = hot_funcs.GetParam(stack, 'get_param', 'Foo')
|
||||||
|
|
||||||
|
return rsrc_defn.ResourceDefinition('rsrc', 'SomeType',
|
||||||
|
{'Foo': param_func})
|
||||||
|
|
||||||
|
self.assertEqual(get_param_defn('bar'), get_param_defn('baz'))
|
||||||
|
|
||||||
def test_hash_equal(self):
|
def test_hash_equal(self):
|
||||||
rd1 = self.make_me_one_with_everything()
|
rd1 = self.make_me_one_with_everything()
|
||||||
rd2 = self.make_me_one_with_everything()
|
rd2 = self.make_me_one_with_everything()
|
||||||
|
Loading…
Reference in New Issue
Block a user