def test_delete_cgroup_snapshot(self): cg_snapshots = self.cinder_cg_snapshots.list() cg_snapshot = self.cinder_cg_snapshots.first() cinder.volume_cg_snapshot_list(IsA(http.HttpRequest)).\ AndReturn(cg_snapshots) cinder.volume_cg_snapshot_delete(IsA(http.HttpRequest), cg_snapshot.id) self.mox.ReplayAll() form_data = {'action': 'volume_cg_snapshots__delete_cg_snapshot__%s' % cg_snapshot.id} res = self.client.post(INDEX_URL, form_data, follow=True) self.assertEqual(res.status_code, 200) self.assertIn("Scheduled deletion of Snapshot: %s" % cg_snapshot.name, [m.message for m in res.context['messages']])
def test_delete_cgroup_snapshot_exception(self): cg_snapshots = self.cinder_cg_snapshots.list() cg_snapshot = self.cinder_cg_snapshots.first() cinder.volume_cg_snapshot_list(IsA(http.HttpRequest)).\ AndReturn(cg_snapshots) cinder.volume_cg_snapshot_delete(IsA(http.HttpRequest), cg_snapshot.id).\ AndRaise(self.exceptions.cinder) self.mox.ReplayAll() form_data = {'action': 'volume_cg_snapshots__delete_cg_snapshot__%s' % cg_snapshot.id} res = self.client.post(VOLUME_CG_SNAPSHOTS_TAB_URL, form_data, follow=True) self.assertEqual(res.status_code, 200) self.assertIn("Unable to delete snapshot: %s" % cg_snapshot.name, [m.message for m in res.context['messages']])
def delete(self, request, obj_id): cinder.volume_cg_snapshot_delete(request, obj_id)