summaryrefslogtreecommitdiff
path: root/nova/tests/unit/volume
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2014-11-24 12:03:32 +0100
committerSylvain Bauza <sbauza@redhat.com>2015-09-09 17:14:35 +0200
commit479005ce5a35039639fa809b1a4705c9d3dc28c4 (patch)
tree890ae54246732dfa2ca2eb8913c0db4627a58456 /nova/tests/unit/volume
parente68db1157a2060dad5fea8ee1980fdc232754f4b (diff)
downloadnova-479005ce5a35039639fa809b1a4705c9d3dc28c4.tar.gz
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
Diffstat (limited to 'nova/tests/unit/volume')
-rw-r--r--nova/tests/unit/volume/test_cinder.py5
1 files changed, 3 insertions, 2 deletions
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):