From 4da718ce544076926abeb01a8ba61b71d33e530e Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 30 Aug 2013 20:45:54 +0200 Subject: [PATCH] Don't stub LoadBalancer.update in autoscaling tests Stub handle_update() instead. We can still verify that the arguments are as expected, while still exercising as much of the logic as possible. Change-Id: Iebb861bb5af27d92e65083c8bac6821f91382dd5 --- heat/tests/test_autoscaling.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/heat/tests/test_autoscaling.py b/heat/tests/test_autoscaling.py index caaa393a..84cb6e6b 100644 --- a/heat/tests/test_autoscaling.py +++ b/heat/tests/test_autoscaling.py @@ -641,16 +641,21 @@ class AutoScalingTest(HeatTestCase): u'LoadBalancerPort': u'80', u'Protocol': u'HTTP'}], u'AvailabilityZones': ['abc', 'xyz']}} - self.m.StubOutWithMock(loadbalancer.LoadBalancer, 'update') - loadbalancer.LoadBalancer.update(expected).AndReturn(None) now = timeutils.utcnow() self._stub_meta_expected(now, 'ExactCapacity : 1') self._stub_create(1) self.m.ReplayAll() stack = utils.parse_stack(t, params=self.params) - rsrc = self.create_scaling_group(t, stack, 'WebServerGroup') + lb = stack['ElasticLoadBalancer'] + self.m.StubOutWithMock(lb, 'handle_update') + lb.handle_update(expected, + mox.IgnoreArg(), + mox.IgnoreArg()).AndReturn(None) + self.m.ReplayAll() + + rsrc = self.create_scaling_group(t, stack, 'WebServerGroup') self.assertEqual('WebServerGroup', rsrc.FnGetRefId()) self.assertEqual(['WebServerGroup-0'], rsrc.get_instance_names()) update_snippet = copy.deepcopy(rsrc.parsed_template()) @@ -678,8 +683,10 @@ class AutoScalingTest(HeatTestCase): 'pool_id': 'pool123', 'members': [u'WebServerGroup-0']} } - self.m.StubOutWithMock(neutron_lb.LoadBalancer, 'update') - neutron_lb.LoadBalancer.update(expected).AndReturn(None) + self.m.StubOutWithMock(neutron_lb.LoadBalancer, 'handle_update') + neutron_lb.LoadBalancer.handle_update(expected, + mox.IgnoreArg(), + mox.IgnoreArg()).AndReturn(None) now = timeutils.utcnow() self._stub_meta_expected(now, 'ExactCapacity : 1') -- 2.45.2