def test_allow_snapshot(self): access_type = "fake_type" access_to = "fake_value" api.share_snapshot_allow(self.request, self.id, access_type, access_to) client = self.manilaclient client.share_snapshots.allow.assert_called_once_with( self.id, access_type, access_to)
def handle(self, request, data): snapshot_id = self.initial['snapshot_id'] try: manila.share_snapshot_allow( request, snapshot_id, access_to=data['access_to'], access_type=data['access_type']) message = _('Creating snapshot rule for "%s"') % data['access_to'] messages.success(request, message) return True except Exception: redirect = reverse("horizon:project:shares:snapshot_manage_rules", args=[self.initial['snapshot_id']]) exceptions.handle( request, _('Unable to add snapshot rule.'), redirect=redirect)
def handle(self, request, data): snapshot_id = self.initial['snapshot_id'] try: manila.share_snapshot_allow( request, snapshot_id, access_to=data['access_to'], access_type=data['access_type']) message = _('Creating snapshot rule for "%s"') % data['access_to'] messages.success(request, message) return True except Exception: redirect = reverse( "horizon:project:share_snapshots:share_snapshot_manage_rules", args=[self.initial['snapshot_id']]) exceptions.handle( request, _('Unable to add snapshot rule.'), redirect=redirect)