def test_is_volume_available(self): available_volumes = [ mock.Mock(status=cinder.AVAILABLE, multiattach=False), mock.Mock(status=cinder.IN_USE, multiattach=True)] unavailable_volumes = [ mock.Mock(status=cinder.IN_USE, multiattach=False), mock.Mock(status='fake-non-status', multiattach=True)] for vol in available_volumes: result = cinder.is_volume_available(vol) self.assertTrue(result, msg="Failed for status '%s'." % vol.status) for vol in unavailable_volumes: result = cinder.is_volume_available(vol) self.assertFalse(result, msg="Failed for status '%s'." % vol.status)