OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#57285] added shared examples for testing set permissions command
Eric Schuberte51e79325650
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rbindex c41353611e8..f16cfffe4a3 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb@@ -40,29 +40,6 @@ module Storagesjson.dig(:file, :mimeType) || (json.key?(:folder) ? "application/x-op-directory" : nil)end- def using_user_token(storage, user, &)- connection_manager = ::OAuthClients::ConnectionManager- .new(user:, configuration: storage.oauth_configuration)-- connection_manager- .get_access_token- .match(- on_success: ->(token) do- connection_manager.request_with_token_refresh(token) { yield token }- end,- on_failure: ->(_) do- ServiceResult.failure(- result: :unauthorized,- errors: StorageError.new(- code: :unauthorized,- data: StorageErrorData.new(source: connection_manager),- log_message: "Query could not be created! No access token found!"- )- )- end- )- end-def storage_error(response:, code:, source:, log_message: nil)# Some errors, like timeouts, aren't json responses so we need to adaptpayload = response.respond_to?(:json) ? response.json(symbolize_keys: true) : response.to_s@@ -79,36 +56,6 @@ module Storages{ headers: { "Content-Type" => "application/json" } }end- # rubocop:disable Metrics/AbcSize- def using_admin_token(storage)- oauth_client = storage.oauth_configuration.basic_rack_oauth_client-- token_result =- begin- Rails.cache.fetch("storage.#{storage.id}.access_token", expires_in: 50.minutes) do- ServiceResult.success(result: oauth_client.access_token!(scope: "https://graph.microsoft.com/.default"))- end- rescue Rack::OAuth2::Client::Error => e- ServiceResult.failure(errors: ::Storages::StorageError.new(- code: :unauthorized,- data: StorageErrorData.new(source: self.class),- log_message: e.message- ))- end-- token_result.match(- on_success: ->(token) do- yield OpenProject.httpx.with(origin: storage.uri,- headers: { authorization: "Bearer #{token.access_token}",- accept: "application/json",- "content-type": "application/json" })- end,- on_failure: ->(errors) { ServiceResult.failure(result: :unauthorized, errors:) }- )- end-- # rubocop:enable Metrics/AbcSize-def extract_location(parent_reference, file_name = "")location = parent_reference[:path].gsub(/.*root:/, "")diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/copy_template_folder_command_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/copy_template_folder_command_spec.rbindex 5495e2f27b3..0ae7e2434be 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/copy_template_folder_command_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/copy_template_folder_command_spec.rb@@ -166,8 +166,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::CopyTemplateenddef existing_folder_tuples- Storages::Peripherals::StorageInteraction::OneDrive::Util.using_admin_token(storage) do |http|- response = http.get("/v1.0/drives/#{storage.drive_id}/root/children?$select=name,id,folder")+ Storages::Peripherals::StorageInteraction::Authentication[auth_strategy].call(storage:) do |http|+ url = Storages::UrlBuilder.url(storage.uri, "/v1.0/drives", storage.drive_id, "/root/children")+ response = http.get("#{url}?$select=name,id,folder")response.json(symbolize_keys: true).fetch(:value, []).filter_map do |item|next unless item.key?(:folder)diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command_spec.rbindex df95f87c200..b159e49add5 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/set_permissions_command_spec.rb@@ -38,12 +38,12 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::SetPermissioendlet(:auth_strategy) do- Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthClientCredentials.new(false)+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthClientCredentials+ .strategy+ .with_cache(false)end- let(:permissions_command) { described_class.new(storage) }-- let(:folder) do+ let(:test_folder) doStorages::Peripherals::Registry.resolve("one_drive.commands.create_folder").call(storage:,@@ -53,155 +53,128 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::SetPermissio.resultend- let(:path) { folder.id }-it_behaves_like "set_permissions_command: basic command setup"- describe "#call" do- after do- Storages::Peripherals::Registry- .resolve("one_drive.commands.delete_folder")- .call(storage:, auth_strategy:, location: path)- end+ context "if file does not exists", vcr: "one_drive/set_permissions_not_found_folder" do+ let(:error_source) { described_class }+ let(:input_data) { permission_input_data("THIS_IS_NOT_THE_FOLDER_YOURE_LOOKING_FOR", []) }- context "when trying to access a non-existing driveItem" do- it "returns a failure", vcr: "one_drive/set_permissions_not_found_folder" do- input_data = input_data(file_id: "THIS_IS_NOT_THE_FOLDER_YOURE_LOOKING_FOR", user_permissions: [])- result = permissions_command.call(auth_strategy:, input_data:)+ it_behaves_like "set_permissions_command: not found"+ end- expect(result).to be_failure- expect(result.result).to eq(:not_found)- end+ context "if a write roles is already set" do+ def current_remote_permissions+ permission_list_from_role("write")end- context "when a permission set already exists" do- it "replaces the write permission grant with the provided list",- vcr: "one_drive/set_permissions_replace_permissions_write" do- user_permissions = [{ user_id: "84acc1d5-61be-470b-9d79-0d1f105c2c5f", permissions: [:write_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)- expect(user_list("write")).to match_array("84acc1d5-61be-470b-9d79-0d1f105c2c5f")-- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)- expect(user_list("write")).to match_array("d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce")- end-- it "replaces the read permission grant with the provided list",- vcr: "one_drive/set_permissions_replace_permissions_read" do- user_permissions = [{ user_id: "84acc1d5-61be-470b-9d79-0d1f105c2c5f", permissions: [:read_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)- expect(user_list("read")).to match_array("84acc1d5-61be-470b-9d79-0d1f105c2c5f")-- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)- expect(user_list("read")).to match_array("d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce")- end- end+ context "and new write permissions should be set", vcr: "one_drive/set_permissions_replace_permissions_write" do+ let(:previous_permissions) { [{ user_id: "84acc1d5-61be-470b-9d79-0d1f105c2c5f", permissions: [:write_files] }] }+ let(:replacing_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }] }- context "when no expected permission exists" do- it "creates the write permission", vcr: "one_drive/set_permissions_create_permission_write" do- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).not_to include("write")+ it_behaves_like "set_permissions_command: replaces already set permissions"+ end- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)+ context "and they should get deleted", vcr: "one_drive/set_permissions_delete_permission_write" do+ let(:previous_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }] }+ let(:replacing_permissions) { [] }- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).to include("write")- end+ it_behaves_like "set_permissions_command: replaces already set permissions"+ end+ end- it "creates the read permission", vcr: "one_drive/set_permissions_create_permission_read" do- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).not_to include("read")+ context "if a read roles is already set", vcr: "one_drive/set_permissions_replace_permissions_read" do+ def current_remote_permissions+ permission_list_from_role("read")+ end- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)+ context "and new read permissions should be set", vcr: "one_drive/set_permissions_replace_permissions_read" do+ let(:previous_permissions) { [{ user_id: "84acc1d5-61be-470b-9d79-0d1f105c2c5f", permissions: [:read_files] }] }+ let(:replacing_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }] }- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).to include("read")- end+ it_behaves_like "set_permissions_command: replaces already set permissions"end- context "when there are no user to set permissions" do- it "deletes the write permission", vcr: "one_drive/set_permissions_delete_permission_write" do- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)+ context "and they should get deleted", vcr: "one_drive/set_permissions_delete_permission_read" do+ let(:previous_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }] }+ let(:replacing_permissions) { [] }- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).to include("write")-- permissions_command.call(auth_strategy:, input_data: input_data(file_id: folder.id, user_permissions: []))+ it_behaves_like "set_permissions_command: replaces already set permissions"+ end+ end- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).not_to include("write")- end+ context "if no write permission exists", vcr: "one_drive/set_permissions_create_permission_write" do+ let(:user_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:write_files] }] }- it "deletes the read permission", vcr: "one_drive/set_permissions_delete_permission_read" do- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)+ def current_remote_permissions+ permission_list_from_role("write")+ end- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).to include("read")+ it_behaves_like "set_permissions_command: creates new permissions"+ end- permissions_command.call(auth_strategy:, input_data: input_data(file_id: folder.id, user_permissions: []))+ context "if no read permission exists", vcr: "one_drive/set_permissions_create_permission_read" do+ let(:user_permissions) { [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }] }- current_roles = remote_permissions.map { |permission| permission[:roles].first }- expect(current_roles).not_to include("read")- end+ def current_remote_permissions+ permission_list_from_role("read")end- context "when there is a timeout" do- it "logs a warning and does not raise NoMethodError", vcr: "one_drive/set_permissions_delete_permission_read" do- stub_request_with_timeout(:post, /invite$/)- allow(Rails.logger).to receive(:error)-- user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }]- input_data = input_data(file_id: folder.id, user_permissions:)- permissions_command.call(auth_strategy:, input_data:)-- # rubocop:disable Layout/LineLength- expect(Rails.logger)- .to have_received(:error)- .with(- error_code: :error,- message: nil,- data: %r{/lib/httpx/response.rb:260:in `full_message': timed out while waiting on select \(HTTPX::ConnectTimeoutError\)\n$}- ).once- # rubocop:enable Layout/LineLength- end+ it_behaves_like "set_permissions_command: creates new permissions"+ end++ context "if a timeout occurs" do+ it "logs an error", vcr: "one_drive/set_permissions_delete_permission_read" do+ stub_request_with_timeout(:post, /invite$/)+ allow(Rails.logger).to receive(:error)++ user_permissions = [{ user_id: "d6e00f6d-1ae7-43e6-b0af-15d99a56d4ce", permissions: [:read_files] }]+ input_data = permission_input_data(test_folder.id, user_permissions)+ described_class.call(storage:, auth_strategy:, input_data:)++ # rubocop:disable Layout/LineLength+ expect(Rails.logger)+ .to have_received(:error)+ .with(+ error_code: :error,+ message: nil,+ data: %r{/lib/httpx/response.rb:260:in `full_message': timed out while waiting on select \(HTTPX::ConnectTimeoutError\)\n$}+ ).once+ # rubocop:enable Layout/LineLengthendendprivate- def input_data(file_id:, user_permissions:)+ def permission_input_data(file_id, user_permissions)Storages::Peripherals::StorageInteraction::Inputs::SetPermissions.build(file_id:, user_permissions:).value!end- def user_list(role)+ def clean_up(file_id)+ Storages::Peripherals::Registry+ .resolve("one_drive.commands.delete_folder")+ .call(storage:, auth_strategy:, location: file_id)+ end++ def permission_list_from_role(role)+ perm = role == "write" ? :write_files : :read_files+remote_permissions.select { |item| item[:roles].first == role }.map { |grant| grant.dig(:grantedToV2, :user, :id) }+ .map { |id| { user_id: id, permissions: [perm] } }enddef remote_permissions- Storages::Peripherals::StorageInteraction::OneDrive::Util.using_admin_token(storage) do |http|- http.get("/v1.0/drives/#{storage.drive_id}/items/#{path}/permissions")+ Storages::Peripherals::StorageInteraction::Authentication[auth_strategy].call(storage:) do |http|+ http.get(Storages::UrlBuilder.url(storage.uri,+ "/v1.0/drives",+ storage.drive_id,+ "/items",+ test_folder.id,+ "/permissions")).raise_for_status.json(symbolize_keys: true).fetch(:value)endend-- def auth_strategy- Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthClientCredentials.strategy- endenddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/util_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/util_spec.rbdeleted file mode 100644index eb9f433a96a..00000000000--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/util_spec.rb+++ /dev/null@@ -1,83 +0,0 @@-# frozen_string_literal: true--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--require "spec_helper"-require_module_spec_helper--RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::Util do- let(:storage) { create(:sharepoint_dev_drive_storage) }-- describe ".using_admin_token" do- it "return a httpx session with an authorization header", vcr: "one_drive/utils_access_tokens" do- described_class.using_admin_token(storage) do |http|- expect(http).to be_a(HTTPX::Session)-- authorization_header = extract_headers(http)["authorization"]- expect(authorization_header).not_to be_nil- expect(authorization_header).to match /Bearer .+$/- end- end-- it "caches the token", vcr: "one_drive/utils_access_token" do- described_class.using_admin_token(storage) do |http|- cached = Rails.cache.fetch("storage.#{storage.id}.access_token") { fail "No value found in the cache" }- token = extract_headers(http)["authorization"].split.last-- expect(cached.result).not_to be_nil- expect(cached.result.access_token).to eq(token)- end- end-- context "when getting the token fails" do- it "returns a ServiceResult.failure", vcr: "one_drive/util_access_token_failure" do- storage.oauth_client.update(client_secret: "this_is_wrong")-- result = described_class.using_admin_token(storage) { |_| fail "this should not run" }-- expect(result).to be_failure- end-- it "does not store data in the cache", vcr: "one_drive/util_access_token_failure" do- storage.oauth_client.update(client_secret: "this_is_wrong")- described_class.using_admin_token(storage) { |_| fail "this should not run" }- cached = Rails.cache.fetch("storage.#{storage.id}.access_token")-- expect(cached).to be_nil- end- end- end-- private-- def extract_headers(session)- options = session.instance_variable_get :@options- options.instance_variable_get :@headers- end-enddiff --git a/modules/storages/spec/services/storages/one_drive_managed_folder_sync_service_spec.rb b/modules/storages/spec/services/storages/one_drive_managed_folder_sync_service_spec.rbindex 892f184ab0e..a67232a398a 100644--- a/modules/storages/spec/services/storages/one_drive_managed_folder_sync_service_spec.rb+++ b/modules/storages/spec/services/storages/one_drive_managed_folder_sync_service_spec.rb@@ -350,8 +350,13 @@ RSpec.describe Storages::OneDriveManagedFolderSyncService, :webmock dodef permissions_for(project_storage)return if project_folder_info(project_storage).failure?- Storages::Peripherals::StorageInteraction::OneDrive::Util.using_admin_token(storage) do |http|- response = http.get("/v1.0/drives/#{storage.drive_id}/items/#{project_storage.project_folder_id}/permissions")+ Storages::Peripherals::StorageInteraction::Authentication[auth_strategy].call(storage:) do |http|+ response = http.get(Storages::UrlBuilder.url(storage.uri,+ "/v1.0/drives",+ storage.drive_id,+ "/items",+ project_storage.project_folder_id,+ "/permissions"))response.json(symbolize_keys: true).fetch(:value, []).each_with_object({}) do |grant, hash|next if grant[:roles].member?("owner")diff --git a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rbindex 146fa88c123..10f3980ee4f 100644--- a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb+++ b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb@@ -35,7 +35,7 @@ require_relative "shared_event_gun_examples"RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :model doshared_examples_for "deleting project storages with project folders" do- let(:command_double) { double(:delete_folder_command, call: ServiceResult.success) }+ let(:command_double) { class_double(command_class_reference, call: ServiceResult.success) }before doStorages::Peripherals::Registry@@ -53,7 +53,7 @@ RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :modelendcontext "if project folder deletion request fails" do- let(:command_double) { double(:delete_folder_command, call: ServiceResult.failure(result: 404)) }+ let(:command_double) { class_double(command_class_reference, call: ServiceResult.failure(result: 404)) }it "tries to remove the project folder at the remote storage and still succeed with deletion" doexpect(described_class.new(model: project_storage, user:).call).to be_success@@ -117,12 +117,6 @@ RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :model"https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{project_storage.project_folder_location}"end- before do- allow(Storages::Peripherals::StorageInteraction::OneDrive::Util)- .to receive(:using_admin_token)- .and_yield(HTTPX.with(origin: storage.uri))- end-it_behaves_like "deleting project storages with project folders"endend@@ -145,4 +139,14 @@ RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :modelit_behaves_like("an event gun", OpenProject::Events::PROJECT_STORAGE_DESTROYED)end++ private++ def command_class_reference+ if storage.provider_type_nextcloud?+ Storages::Peripherals::StorageInteraction::Nextcloud::DeleteFolderCommand+ else+ Storages::Peripherals::StorageInteraction::OneDrive::DeleteFolderCommand+ end+ endenddiff --git a/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rbindex 24b0d5ab830..bf9659503b2 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb@@ -44,6 +44,60 @@ RSpec.shared_examples_for "set_permissions_command: basic command setup" doendend+RSpec.shared_examples_for "set_permissions_command: replaces already set permissions" do+ it "replaces fully the previously set permissions" do+ file_id = test_folder.id++ input_data = Storages::Peripherals::StorageInteraction::Inputs::SetPermissions+ .build(file_id:, user_permissions: previous_permissions)+ .value!+ result = described_class.call(storage:, auth_strategy:, input_data:)++ expect(result).to be_success+ expect(current_remote_permissions).to eq(previous_permissions)++ input_data = Storages::Peripherals::StorageInteraction::Inputs::SetPermissions+ .build(file_id:, user_permissions: replacing_permissions)+ .value!+ result = described_class.call(storage:, auth_strategy:, input_data:)++ expect(result).to be_success+ expect(current_remote_permissions).to eq(replacing_permissions)+ ensure+ clean_up file_id+ end+end++RSpec.shared_examples_for "set_permissions_command: creates new permissions" do+ it "creates the new permissions" do+ file_id = test_folder.id++ expect(current_remote_permissions).to eq([])++ input_data = Storages::Peripherals::StorageInteraction::Inputs::SetPermissions+ .build(file_id:, user_permissions:)+ .value!+ result = described_class.call(storage:, auth_strategy:, input_data:)++ expect(result).to be_success+ expect(current_remote_permissions).to eq(user_permissions)+ ensure+ clean_up file_id+ end+end++RSpec.shared_examples_for "set_permissions_command: not found" do+ it "returns a failure" do+ result = described_class.call(storage:, auth_strategy:, input_data:)++ expect(result).to be_failure++ error = result.errors+ expect(error.code).to eq(:not_found)+ expect(error.data.source).to eq(error_source)+ end+end+RSpec.shared_examples_for "set_permissions_command: error" doit "returns a failure" doresult = described_class.call(storage:, auth_strategy:, input_data:)