def test_should_delete(self): self.assertEqual( False, cinder.Volumes(self.creds_manager).should_delete( {'os-vol-tenant-attr:tenant_id': 84})) self.assertEqual( True, cinder.Volumes(self.creds_manager).should_delete( {'os-vol-tenant-attr:tenant_id': 42}))
def test_check_prerequisite(self): self.cloud.list_volume_snapshots.return_value = [] self.assertEqual( False, cinder.Volumes(self.creds_manager).check_prerequisite()) self.cloud.list_volume_snapshots.assert_called_once_with() self.cloud.list_servers.assert_called_once_with()
def test_list(self): self.assertIs(self.cloud.list_volumes.return_value, cinder.Volumes(self.creds_manager).list()) self.cloud.list_volumes.assert_called_once_with()
def test_to_string(self): volume = mock.MagicMock() self.assertIn("Volume ", cinder.Volumes(self.creds_manager).to_str(volume))
def test_disable(self): volume = mock.MagicMock() cinder.Volumes(self.creds_manager).disable(volume) self.cloud.update_volume.assert_called_once_with( volume['id'], metadata={'readonly': 'true'})
def test_delete(self): volume = mock.MagicMock() self.assertIsNone(cinder.Volumes(self.creds_manager).delete(volume)) self.cloud.delete_volume.assert_called_once_with(volume['id'])