예제 #1
0
    def test_share_delete_metadata(self):
        fake_keys = ["aim", "project", "deadline"]

        api.share_delete_metadata(self.request, self.id, fake_keys)

        self.manilaclient.shares.delete_metadata.assert_called_once_with(
            self.id, fake_keys)
예제 #2
0
파일: forms.py 프로젝트: ajarr/manila-ui
 def handle(self, request, data):
     share_id = self.initial['share_id']
     try:
         share = manila.share_get(self.request, share_id)
         set_dict, unset_list = utils.parse_str_meta(data['metadata'])
         if set_dict:
             manila.share_set_metadata(request, share, set_dict)
         if unset_list:
             manila.share_delete_metadata(request, share, unset_list)
         message = _('Updating share metadata "%s"') % share.name
         messages.success(request, message)
         return True
     except ValidationError as e:
         self.api_error(e.messages[0])
         return False
     except Exception:
         redirect = reverse("horizon:project:shares:index")
         exceptions.handle(request,
                           _('Unable to update share metadata.'),
                           redirect=redirect)
예제 #3
0
 def handle(self, request, data):
     share_id = self.initial['share_id']
     try:
         share = manila.share_get(self.request, share_id)
         set_dict, unset_list = utils.parse_str_meta(data['metadata'])
         if set_dict:
             manila.share_set_metadata(request, share, set_dict)
         if unset_list:
             manila.share_delete_metadata(request, share, unset_list)
         message = _('Updating share metadata "%s"') % share.name
         messages.success(request, message)
         return True
     except ValidationError as e:
         self.api_error(e.messages[0])
         return False
     except Exception:
         redirect = reverse("horizon:project:shares:index")
         exceptions.handle(request,
                           _('Unable to update share metadata.'),
                           redirect=redirect)