def test_share_revert(self): share = 'fake_share' snapshot = 'fake_snapshot' api.share_revert(self.request, share, snapshot) self.manilaclient.shares.revert_to_snapshot.assert_called_once_with( share, snapshot)
def handle(self, request, data): share_id = self.initial['share_id'] snapshot_id = data['snapshot'] try: manila.share_revert(request, share_id, snapshot_id) message = _('Share "%(s)s" has been reverted to "%(ss)s" snapshot ' 'successfully') % {'s': share_id, 'ss': snapshot_id} messages.success(request, message) return True except Exception: redirect = reverse("horizon:project:shares:index") exceptions.handle( request, _('Unable to revert share to the snapshot.'), redirect=redirect)