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
[#54553] fixed test setup and query usage
Eric Schubertc076d8b8186d
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rbindex ef604efcff0..fcf1a4d1c74 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb@@ -57,9 +57,10 @@ module Storagesprivatedef upload_data_failure- Util.failure(code: :error,- data: StorageErrorData.new(source: self.class),- log_message: "Invalid upload data!")+ ServiceResult.failure(result: :error,+ errors: StorageError.new(code: :error,+ data: StorageErrorData.new(source: self.class),+ log_message: "Invalid upload data!"))enddef invalid?(upload_data:)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 a05ec40e2b4..fe18cd81966 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@@ -95,7 +95,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::CopyTemplatecommand_result = described_class.call(storage:, source_path:, destination_path: "My New Folder")expect(command_result).to be_success- expect(command_result.result.requires_polling?).to be_truthy+ expect(command_result.result).to be_requires_pollingexpect(command_result.result.polling_url).to match %r</drives/#{storage.drive_id}/items/.+\?.+$>ensuredelete_copied_folder(command_result.result.polling_url)@@ -161,11 +161,10 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::CopyTemplatesubfolder = command.call(auth_strategy:, folder_name: "Subfolder with File", parent_location:).resultfile_name = "files_query_root.yml"- token = OAuthClientToken.last-+ upload_data = Storages::UploadData.new(folder_id: subfolder.id, file_name:)upload_link = Storages::Peripherals::Registry.resolve("one_drive.queries.upload_link")- .call(storage:, user: token.user, data: { "parent" => subfolder.id, "file_name" => file_name })+ .call(storage:, auth_strategy:, upload_data:).resultpath = Rails.root.join("modules/storages/spec/support/fixtures/vcr_cassettes/one_drive", file_name)diff --git a/modules/storages/spec/lib/api/v3/storage_files/storage_upload_link_representer_spec.rb b/modules/storages/spec/lib/api/v3/storage_files/storage_upload_link_representer_spec.rbindex faee87adc67..7f8613bcdc0 100644--- a/modules/storages/spec/lib/api/v3/storage_files/storage_upload_link_representer_spec.rb+++ b/modules/storages/spec/lib/api/v3/storage_files/storage_upload_link_representer_spec.rb@@ -38,7 +38,7 @@ RSpec.describe API::V3::StorageFiles::StorageUploadLinkRepresenter, "rendering"let(:token) { "xyz123" }let(:destination) { "https://example.com/upload/#{token}" }let(:upload_link) do- Storages::UploadLink.new("https://example.com/upload/#{token}")+ Storages::UploadLink.new("https://example.com/upload/#{token}", :post)endlet(:representer) { described_class.new(upload_link, current_user: user) }diff --git a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rbindex afe0bd2febe..325d43367fb 100644--- a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb@@ -31,6 +31,7 @@require "spec_helper"require_module_spec_helper+# rubocop:disable RSpecRails/HaveHttpStatusRSpec.describe "API v3 storage files", :webmock, content_type: :json doinclude API::V3::Utilities::PathHelperinclude StorageServerHelpers@@ -249,7 +250,7 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json dodescribe "POST /api/v3/storages/:storage_id/files/prepare_upload" dolet(:permissions) { %i(view_work_packages view_file_links manage_file_links) }let(:path) { api_v3_paths.prepare_upload(storage.id) }- let(:upload_link) { Storages::UploadLink.new("https://example.com/upload/xyz123") }+ let(:upload_link) { Storages::UploadLink.new("https://example.com/upload/xyz123", :post) }let(:body) { { fileName: "ape.png", parent: "/Pictures", projectId: project.id }.to_json }subject(:last_response) do@@ -323,3 +324,5 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json doendendend++# rubocop:enable RSpecRails/HaveHttpStatus