Fix unit tests: no more cinderclient v1

The most recent version of python-cinderclient dropped the support
for cinderclient v1.
We could bump the minimum cinderclient version, but the Cinder v1
API has been deprecated since Juno, so we can safely ignore it.

Change-Id: I8e90e812882fa1288bc379606a55305c30cd6656
This commit is contained in:
Luigi Toscano 2019-09-20 21:35:58 +02:00
parent 7e3184c561
commit 3e61559192
1 changed files with 0 additions and 20 deletions

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cinderclient.v1 import volumes as vol_v1
from cinderclient.v2 import volumes as vol_v2
from cinderclient.v3 import volumes as vol_v3
import mock
@ -40,25 +39,6 @@ class TestAttachVolume(base.SaharaWithDbTestCase):
self.assertRaises(ex.RemoteCommandException, volumes._mount_volume,
instance, '123', '456', False)
@mock.patch('sahara.conductor.manager.ConductorManager.cluster_get')
@mock.patch('cinderclient.v1.volumes.Volume.delete')
@mock.patch('cinderclient.v1.volumes.Volume.detach')
@mock.patch('sahara.utils.openstack.cinder.get_volume')
def test_detach_volumes(self, p_get_volume, p_detach, p_delete, p_cond):
class Instance(object):
def __init__(self):
self.instance_id = '123454321'
self.volumes = [123]
self.instance_name = 'spam'
instance = Instance()
p_get_volume.return_value = vol_v1.Volume(None, {'id': '123', 'status':
'available'})
p_detach.return_value = None
p_delete.return_value = None
self.assertIsNone(
volumes.detach_from_instance(instance))
@mock.patch('sahara.conductor.manager.ConductorManager.cluster_get')
@mock.patch('cinderclient.v2.volumes.Volume.delete')
@mock.patch('cinderclient.v2.volumes.Volume.detach')