def test_share_group_snapshot_create(self): sg = 'fake_share_group' name = 'fake_name' desc = 'fake_description' result = api.share_group_snapshot_create(self.request, sg, name, desc) self.assertIsNotNone(result) self.assertEqual( self.manilaclient.share_group_snapshots.create.return_value, result) self.manilaclient.share_group_snapshots.create.assert_called_once_with( share_group=sg, name=name, description=desc)
def test_share_group_snapshot_create(self): sg = 'fake_share_group' name = 'fake_name' desc = 'fake_description' result = api.share_group_snapshot_create(self.request, sg, name, desc) self.assertIsNotNone(result) self.assertEqual( self.manilaclient.share_group_snapshots.create.return_value, result) self.manilaclient.share_group_snapshots.create.assert_called_once_with( share_group=sg, name=name, description=desc)
def handle(self, request, data): try: snapshot = manila.share_group_snapshot_create( request, data['share_group_id'], data['name'], data['description']) message = _('Creating share group snapshot "%s".') % data['name'] messages.success(request, message) return snapshot except Exception: redirect = reverse("horizon:project:share_group_snapshots:index") exceptions.handle( request, _('Unable to create share group snapshot.'), redirect=redirect) return False
def handle(self, request, data): try: snapshot = manila.share_group_snapshot_create( request, data['share_group_id'], data['name'], data['description']) message = _('Creating share group snapshot "%s".') % data['name'] messages.success(request, message) return snapshot except Exception: redirect = reverse("horizon:project:share_group_snapshots:index") exceptions.handle( request, _('Unable to create share group snapshot.'), redirect=redirect) return False