From 479005ce5a35039639fa809b1a4705c9d3dc28c4 Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Mon, 24 Nov 2014 12:03:32 +0100 Subject: Consolidate code to get the correct availability zone of an instance This makes getting the availability zone of an instance use the same code by placing it inside the helper get_instance_availability_zone(). Related-Bug: #1390033 Change-Id: I69b98eacbc8dc91e65611d6bf07272b517fe350d --- nova/tests/unit/volume/test_cinder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nova/tests/unit/volume') diff --git a/nova/tests/unit/volume/test_cinder.py b/nova/tests/unit/volume/test_cinder.py index 4e5e4892f5..7b51c2af96 100644 --- a/nova/tests/unit/volume/test_cinder.py +++ b/nova/tests/unit/volume/test_cinder.py @@ -175,11 +175,12 @@ class CinderApiTestCase(test.NoDBTestCase): volume['availability_zone'] = 'zone1' self.assertIsNone(self.api.check_attach( self.ctx, volume, instance)) - self.assertFalse(mock_get_instance_az.called) + mock_get_instance_az.assert_called_once_with(self.ctx, instance) + mock_get_instance_az.reset_mock() volume['availability_zone'] = 'zone2' self.assertRaises(exception.InvalidVolume, self.api.check_attach, self.ctx, volume, instance) - self.assertFalse(mock_get_instance_az.called) + mock_get_instance_az.assert_called_once_with(self.ctx, instance) cinder.CONF.reset() def test_check_attach(self): -- cgit v1.2.1