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
[#50543] added vcr unit tests for queries
Eric Schubert87036b9b1dbd
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rbindex a45f8d92193..6e4cf0fa64c 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rb@@ -43,11 +43,6 @@ RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::OpenFileLinexpect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user], %i[keyreq file_id], %i[key open_location])end- it 'returns the url for opening the storage if no file id is provided' do- url = described_class.call(storage:, user:, file_id: nil).result- expect(url).to eq("#{storage.host}/index.php/apps/files")- end-it 'returns the url for opening the file on storage' dourl = described_class.call(storage:, user:, file_id:).resultexpect(url).to eq("#{storage.host}/index.php/f/#{file_id}?openfile=1")diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query_spec.rbnew file mode 100644index 00000000000..fbcd356c37c--- /dev/null+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query_spec.rb@@ -0,0 +1,58 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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::Nextcloud::OpenStorageQuery do+ let(:storage) { create(:nextcloud_storage, host: 'https://example.com') }+ let(:user) { create(:user) }++ it 'responds to .call' do+ expect(described_class).to respond_to(:call)++ method = described_class.method(:call)+ expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user])+ end++ it 'returns the url for opening the file on storage' do+ url = described_class.call(storage:, user:).result+ expect(url).to eq("#{storage.host}/index.php/apps/files")+ end++ context 'with a storage with host url with a sub path' do+ let(:storage) { create(:nextcloud_storage, host: 'https://example.com/html') }++ it 'returns the url for opening the file on storage' do+ url = described_class.call(storage:, user:).result+ expect(url).to eq("#{storage.host}/index.php/apps/files")+ end+ end+enddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rbindex 943649571fd..ecaa791013e 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rb@@ -31,72 +31,89 @@require 'spec_helper'require_module_spec_helper-RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenFileLinkQuery, :webmock do- include JsonResponseHelper+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenFileLinkQuery, :vcr, :webmock do+ using Storages::Peripherals::ServiceResultRefinements- let(:storage) do- create(:one_drive_storage,- :with_oauth_client,- drive_id: 'b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd')- endlet(:user) { create(:user) }- let(:token) { create(:oauth_client_token, user:, oauth_client: storage.oauth_client) }- let(:folder_id) { '01BYE5RZ5MYLM2SMX75ZBIPQZIHT6OAYPB' }- let(:file_id) { '01BYE5RZ7T3DFLFS6TCRH2QAPWXL5APDLE' }- let(:not_found_json) { not_found_response }- let(:forbidden_json) { forbidden_response }-- it 'responds to .call' do- expect(described_class).to respond_to(:call)+ let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }+ let(:file_id) { '01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU' }- method = described_class.method(:call)- expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user], %i[keyreq file_id], %i[key open_location])- end+ subject { described_class.new(storage) }- it 'returns the url for opening the file on storage' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 200, body: read_json('file_drive_item_1'), headers: {})-- url = described_class.call(storage:, user:, file_id:).result- expect(url).to eq('https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7BB2CAD8F3-D3CB-4F14-A801-F6BAFA078D64%7D&file=Popular%20Mixed%20Drinks.xlsx&action=default&mobileredirect=true')- end+ describe '#call' do+ it 'responds with correct parameters' do+ expect(described_class).to respond_to(:call)- it 'returns the url for opening the file\'s location on storage' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}?$select=parentReference")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 200, body: read_json('file_drive_item_1'), headers: {})- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{folder_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 200, body: read_json('folder_drive_item'), headers: {})+ method = described_class.method(:call)+ expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user], %i[keyreq file_id], %i[key open_location])+ end- url = described_class.call(storage:, user:, file_id:, open_location: true).result- expect(url).to eq('https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/Documents/Business%20Data')- end+ context 'with outbound requests successful' do+ context 'with open location flag not set', vcr: 'one_drive/open_file_link_query_success' do+ it 'returns the url for opening the file on storage' do+ call = subject.call(user:, file_id:)+ expect(call).to be_success+ expect(call.result).to eq('https://finn.sharepoint.com/sites/openprojectfilestoragetests/_layouts/15/Doc.aspx?sourcedoc=%7B3D884033-B88B-4195-8F36-D30B41AB9234%7D&file=Document.docx&action=default&mobileredirect=true')+ end+ end++ context 'with open location flag set', vcr: 'one_drive/open_file_link_location_query_success' do+ it 'returns the url for opening the file on storage' do+ call = subject.call(user:, file_id:, open_location: true)+ expect(call).to be_success+ expect(call.result).to eq('https://finn.sharepoint.com/sites/openprojectfilestoragetests/VCR/Folder')+ end+ end+ end- describe 'error handling' do- it 'returns a notfound error if the API call returns a 404' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 404, body: not_found_json, headers: {})+ context 'with not existent oauth token' do+ let(:user_without_token) { create(:user) }- open_link_result = described_class.call(storage:, user:, file_id:)+ it 'must return unauthorized when called' do+ result = subject.call(user: user_without_token, file_id:)+ expect(result).to be_failure+ expect(result.error_source).to be_a(OAuthClients::ConnectionManager)- expect(open_link_result).to be_failure- expect(open_link_result.result).to eq(:not_found)- expect(open_link_result.errors.data.payload.to_json).to eq(not_found_json)+ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ endend- it 'returns a forbidden error if the API call returns a 403' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 403, body: forbidden_json, headers: {})+ context 'with not existent file id', vcr: 'one_drive/open_file_link_query_missing_file_id' do+ let(:file_id) { 'iamnotexistent' }- open_link_result = described_class.call(storage:, user:, file_id:)+ it 'must return not found' do+ result = subject.call(user:, file_id:)+ expect(result).to be_failure+ expect(result.error_source).to be_a(Storages::Peripherals::StorageInteraction::OneDrive::Internal::DriveItemQuery)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:not_found) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end- expect(open_link_result).to be_failure- expect(open_link_result.result).to eq(:forbidden)- expect(open_link_result.errors.data.payload.to_json).to eq(forbidden_json)+ context 'with invalid oauth token', vcr: 'one_drive/open_file_link_query_invalid_token' do+ before do+ token = build_stubbed(:oauth_client_token, oauth_client: storage.oauth_client)+ allow(Storages::Peripherals::StorageInteraction::OneDrive::Util)+ .to receive(:using_user_token)+ .and_yield(token)+ end++ it 'must return unauthorized' do+ result = subject.call(user:, file_id:)+ expect(result).to be_failure+ expect(result.error_source).to be_a(Storages::Peripherals::StorageInteraction::OneDrive::Internal::DriveItemQuery)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ endendendenddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rbindex e1011ba9f7f..60daeb29abd 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb@@ -32,59 +32,62 @@ require 'spec_helper'require_module_spec_helperRSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenStorageQuery, :webmock do- include JsonResponseHelper-using Storages::Peripherals::ServiceResultRefinements- let(:storage) do- create(:one_drive_storage,- :with_oauth_client,- drive_id: 'b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd')- endlet(:user) { create(:user) }- let(:token) { create(:oauth_client_token, user:, oauth_client: storage.oauth_client) }- let(:not_found_json) { not_found_response }- let(:forbidden_json) { forbidden_response }+ let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }- it 'responds to .call' do- expect(described_class).to respond_to(:call)+ subject { described_class.new(storage) }- method = described_class.method(:call)- expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user])- end+ describe '#call' do+ it 'responds with correct parameters' do+ expect(described_class).to respond_to(:call)- it 'returns the url for opening the drive root on storage' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 200, body: read_json('root_drive'), headers: {})+ method = described_class.method(:call)+ expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user])+ end- url = described_class.call(storage:, user:).result- expect(url).to eq('https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/Documents')- end+ context 'with outbound requests successful', vcr: 'one_drive/open_storage_query_success' do+ it 'returns the url for opening the storage' do+ call = subject.call(user:)+ expect(call).to be_success+ expect(call.result).to eq('https://finn.sharepoint.com/sites/openprojectfilestoragetests/VCR')+ end+ end- describe 'error handling' do- it 'returns a notfound error if the API call returns a 404' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 404, body: not_found_json, headers: {})+ context 'with not existent oauth token' do+ let(:user_without_token) { create(:user) }- open_drive_link_result = described_class.call(storage:, user:)+ it 'must return unauthorized when called' do+ result = subject.call(user: user_without_token)+ expect(result).to be_failure+ expect(result.error_source).to be_a(OAuthClients::ConnectionManager)- expect(open_drive_link_result).to be_failure- expect(open_drive_link_result.result).to eq(:not_found)- expect(open_drive_link_result.error_payload.to_json).to eq(not_found_json)+ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ endend- it 'returns a forbidden error if the API call returns a 403' do- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}?$select=webUrl")- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .to_return(status: 403, body: forbidden_json, headers: {})+ context 'with invalid oauth token', vcr: 'one_drive/open_storage_query_invalid_token' do+ before do+ token = build_stubbed(:oauth_client_token, oauth_client: storage.oauth_client)+ allow(Storages::Peripherals::StorageInteraction::OneDrive::Util)+ .to receive(:using_user_token)+ .and_yield(token)+ end- open_drive_link_result = described_class.call(storage:, user:)+ it 'must return unauthorized' do+ result = subject.call(user:)+ expect(result).to be_failure+ expect(result.error_source).to be_a(described_class)- expect(open_drive_link_result).to be_failure- expect(open_drive_link_result.result).to eq(:forbidden)- expect(open_drive_link_result.error_payload.to_json).to eq(forbidden_json)+ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ endendendenddiff --git a/modules/storages/spec/features/storages_menu_links_spec.rb b/modules/storages/spec/features/storages_menu_links_spec.rbindex 48a8bd89c56..81f00395f61 100644--- a/modules/storages/spec/features/storages_menu_links_spec.rb+++ b/modules/storages/spec/features/storages_menu_links_spec.rb@@ -32,6 +32,8 @@ require 'spec_helper'require_module_spec_helperRSpec.describe 'Project menu', :js, :with_cuprite do+ include API::V3::Utilities::PathHelper+let(:storage) { create(:nextcloud_storage, name: "Storage 1") }let(:another_storage) { create(:nextcloud_storage, name: "Storage 2") }let(:unlinked_storage) { create(:nextcloud_storage, name: "Storage 3") }diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_location_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_location_query_success.ymlnew file mode 100644index 00000000000..6f7d7a70026--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_location_query_success.yml@@ -0,0 +1,95 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/items/01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU?$select=parentReference+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <ACCESS_TOKEN>+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-cache+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8+ Etag:+ - '"{3D884033-B88B-4195-8F36-D30B41AB9234},5"'+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - e5f991d2-3358-4694-93dd-0c4e2bf0eb33+ Client-Request-Id:+ - e5f991d2-3358-4694-93dd-0c4e2bf0eb33+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"FR3PEPF000002DC"}}'+ Odata-Version:+ - '4.0'+ Date:+ - Wed, 18 Oct 2023 11:19:43 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives(''b%21dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs'')/items(parentReference)/$entity","@odata.etag":"\"{3D884033-B88B-4195-8F36-D30B41AB9234},5\"","parentReference":{"driveType":"documentLibrary","driveId":"b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs","id":"01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR","name":"Folder","path":"/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/root:/Folder","siteId":"1b4b6576-906d-4d94-8f49-6d00a9507b50"}}'+ recorded_at: Wed, 18 Oct 2023 11:19:43 GMT+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/items/01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <ACCESS_TOKEN>+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-cache+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8+ Etag:+ - '"{6087B980-4C01-4020-BBF2-1E349BD0C831},1"'+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 9e4c6634-4ae1-44cb-bc53-4904ff8eed29+ Client-Request-Id:+ - 9e4c6634-4ae1-44cb-bc53-4904ff8eed29+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"FR3PEPF000002E0"}}'+ Odata-Version:+ - '4.0'+ Date:+ - Wed, 18 Oct 2023 11:19:43 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives(''b%21dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs'')/items(webUrl)/$entity","@odata.etag":"\"{6087B980-4C01-4020-BBF2-1E349BD0C831},1\"","webUrl":"https://finn.sharepoint.com/sites/openprojectfilestoragetests/VCR/Folder"}'+ recorded_at: Wed, 18 Oct 2023 11:19:43 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_invalid_token.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_invalid_token.ymlnew file mode 100644index 00000000000..086d7558356--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_invalid_token.yml@@ -0,0 +1,47 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/items/01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer 1234567890-1+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - c1899d3c-0828-4441-80c5-26ed3eb657d4+ Client-Request-Id:+ - c1899d3c-0828-4441-80c5-26ed3eb657d4+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"004","RoleInstance":"FR2PEPF0000039E"}}'+ Www-Authenticate:+ - Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000"+ Date:+ - Wed, 18 Oct 2023 11:24:58 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"InvalidAuthenticationToken","message":"CompactToken+ parsing failed with error code: 80049217","innerError":{"date":"2023-10-18T11:24:58","request-id":"c1899d3c-0828-4441-80c5-26ed3eb657d4","client-request-id":"c1899d3c-0828-4441-80c5-26ed3eb657d4"}}}'+ recorded_at: Wed, 18 Oct 2023 11:24:58 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_missing_file_id.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_missing_file_id.ymlnew file mode 100644index 00000000000..cb5832593dc--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_missing_file_id.yml@@ -0,0 +1,45 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/items/iamnotexistent?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <ACCESS_TOKEN>+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 404+ message: Not Found+ headers:+ Cache-Control:+ - no-store, no-cache+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 0e00ab2f-367b-4aca-bcc1-bd6c6d70a14a+ Client-Request-Id:+ - 0e00ab2f-367b-4aca-bcc1-bd6c6d70a14a+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"FR3PEPF00000362"}}'+ Date:+ - Wed, 18 Oct 2023 11:28:17 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"itemNotFound","message":"Item not found","innerError":{"date":"2023-10-18T11:28:17","request-id":"0e00ab2f-367b-4aca-bcc1-bd6c6d70a14a","client-request-id":"0e00ab2f-367b-4aca-bcc1-bd6c6d70a14a"}}}'+ recorded_at: Wed, 18 Oct 2023 11:28:17 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_success.ymlnew file mode 100644index 00000000000..4fd00f4d9e1--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_file_link_query_success.yml@@ -0,0 +1,49 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/items/01AZJL5PJTICED3C5YSVAY6NWTBNA2XERU?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <ACCESS_TOKEN>+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-cache+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8+ Etag:+ - '"{3D884033-B88B-4195-8F36-D30B41AB9234},5"'+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 7d445471-cdbf-438f-874a-332096adeae9+ Client-Request-Id:+ - 7d445471-cdbf-438f-874a-332096adeae9+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"FR2PEPF000001E0"}}'+ Odata-Version:+ - '4.0'+ Date:+ - Wed, 18 Oct 2023 09:29:31 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives(''b%21dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs'')/items(webUrl)/$entity","@odata.etag":"\"{3D884033-B88B-4195-8F36-D30B41AB9234},5\"","webUrl":"https://finn.sharepoint.com/sites/openprojectfilestoragetests/_layouts/15/Doc.aspx?sourcedoc=%7B3D884033-B88B-4195-8F36-D30B41AB9234%7D&file=Document.docx&action=default&mobileredirect=true"}'+ recorded_at: Wed, 18 Oct 2023 09:29:32 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_invalid_token.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_invalid_token.ymlnew file mode 100644index 00000000000..0a865ab251a--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_invalid_token.yml@@ -0,0 +1,47 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer 1234567890-1+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - dc3446a9-9239-4e75-a70e-4db0f73167dd+ Client-Request-Id:+ - dc3446a9-9239-4e75-a70e-4db0f73167dd+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"FR3PEPF00000165"}}'+ Www-Authenticate:+ - Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000"+ Date:+ - Wed, 18 Oct 2023 11:33:26 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"InvalidAuthenticationToken","message":"CompactToken+ parsing failed with error code: 80049217","innerError":{"date":"2023-10-18T11:33:27","request-id":"dc3446a9-9239-4e75-a70e-4db0f73167dd","client-request-id":"dc3446a9-9239-4e75-a70e-4db0f73167dd"}}}'+ recorded_at: Wed, 18 Oct 2023 11:33:27 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_success.ymlnew file mode 100644index 00000000000..fbe7531ec72--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/open_storage_query_success.yml@@ -0,0 +1,47 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs?$select=webUrl+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <ACCESS_TOKEN>+ Accept-Encoding:+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3+ Accept:+ - "*/*"+ User-Agent:+ - Ruby+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-store, no-cache+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 94c777a5-8135-4696-89d6-1031a4e41132+ Client-Request-Id:+ - 94c777a5-8135-4696-89d6-1031a4e41132+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"FR2PEPF000001E0"}}'+ Odata-Version:+ - '4.0'+ Date:+ - Wed, 18 Oct 2023 11:33:27 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives(webUrl)/$entity","webUrl":"https://finn.sharepoint.com/sites/openprojectfilestoragetests/VCR"}'+ recorded_at: Wed, 18 Oct 2023 11:33:27 GMT+recorded_with: VCR 6.2.0