def test_share_group_snapshot_reset_state(self): sgs = 'fake_share_group_snapshot' state = 'fake_state' result = api.share_group_snapshot_reset_state(self.request, sgs, state) rs_method = self.manilaclient.share_group_snapshots.reset_state self.assertIsNotNone(result) self.assertEqual(rs_method.return_value, result) rs_method.assert_called_once_with(sgs, state)
def test_share_group_snapshot_reset_state(self): sgs = 'fake_share_group_snapshot' state = 'fake_state' result = api.share_group_snapshot_reset_state(self.request, sgs, state) rs_method = self.manilaclient.share_group_snapshots.reset_state self.assertIsNotNone(result) self.assertEqual(rs_method.return_value, result) rs_method.assert_called_once_with(sgs, state)
def handle(self, request, data): s_id = self.initial['share_group_snapshot_id'] try: manila.share_group_snapshot_reset_state( request, s_id, data["status"]) message = _( "Reseting share group snapshot ('%(id)s') status " "from '%(from)s' to '%(to)s'.") % { "id": self.initial['share_group_snapshot_name'] or s_id, "from": self.initial['share_group_snapshot_status'], "to": data["status"]} messages.success(request, message) return True except Exception: redirect = reverse("horizon:admin:share_group_snapshots:index") exceptions.handle( request, _("Unable to reset status of share group snapshot " "'%s'.") % s_id, redirect=redirect) return False