def handle(self, request, data): sgs_id = self.initial['share_group_snapshot_id'] try: manila.share_group_snapshot_update( request, sgs_id, data['name'], data['description']) message = _('Updating share group snapshot "%s"') % data['name'] messages.success(request, message) return True except Exception: redirect = reverse("horizon:project:share_group_snapshots:index") exceptions.handle( request, _('Unable to update share group snapshot.'), redirect=redirect) return False
def test_share_group_snapshot_update(self): sgs = 'fake_share_group_snapshot' name = 'fake_name' desc = 'fake_description' result = api.share_group_snapshot_update(self.request, sgs, name, desc) self.assertIsNotNone(result) self.assertEqual( self.manilaclient.share_group_snapshots.update.return_value, result) self.manilaclient.share_group_snapshots.update.assert_called_once_with( sgs, name=name, description=desc)