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
[#53369] fixed unit test setup
Eric Schubert821c91ce02eb
diff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rbindex 48389a335a4..0dc0bfb1d6e 100644--- a/app/controllers/oauth_clients_controller.rb+++ b/app/controllers/oauth_clients_controller.rb@@ -78,25 +78,22 @@ class OAuthClientsController < ApplicationControllerhandle_absent_oauth_client unless oauth_client- connection_manager = OAuthClients::ConnectionManager.new(- user: User.current,- configuration: oauth_client.integration.oauth_configuration- )-+ storage = oauth_client.integration# check if the origin is the same- destination_url = if params.fetch(:destination_url, '').start_with?(root_url)+ destination_url = if params.fetch(:destination_url, "").start_with?(root_url)params[:destination_url]elseroot_urlendauth_state = ::Storages::Peripherals::StorageInteraction::Authentication- .authorization_state(storage: oauth_client.integration, user: User.current)+ .authorization_state(storage:, user: User.current)+if auth_state == :connectedredirect_to(destination_url)elsenonce = SecureRandom.uuidcookies["oauth_state_#{nonce}"] = { value: { href: destination_url, storageId: storage_id }.to_json, expires: 1.hour }- redirect_to(connection_manager.get_authorization_uri(state: nonce))+ redirect_to(storage.oauth_configuration.authorization_uri(state: nonce))endend@@ -105,8 +102,8 @@ class OAuthClientsController < ApplicationControllerprivatedef handle_absent_oauth_client- flash[:error] = [I18n.t('oauth_client.errors.oauth_client_not_found'),- I18n.t('oauth_client.errors.oauth_client_not_found_explanation')]+ flash[:error] = [I18n.t("oauth_client.errors.oauth_client_not_found"),+ I18n.t("oauth_client.errors.oauth_client_not_found_explanation")]if User.current.admin?redirect_to admin_settings_storages_path@@ -128,9 +125,9 @@ class OAuthClientsController < ApplicationControllerservice_result.errors = service_result.errors.to_active_model_errorsend- flash[:error] = ["#{t(:'oauth_client.errors.oauth_authorization_code_grant_had_errors')}:"]+ flash[:error] = ["#{t(:"oauth_client.errors.oauth_authorization_code_grant_had_errors")}:"]service_result.errors.each do |error|- flash[:error] << "#{t(:'oauth_client.errors.oauth_reported')}: #{error.full_message}"+ flash[:error] << "#{t(:"oauth_client.errors.oauth_reported")}: #{error.full_message}"endend@@ -141,8 +138,8 @@ class OAuthClientsController < ApplicationController@code = params[:code]if @code.blank?- flash[:error] = [I18n.t('oauth_client.errors.oauth_code_not_present'),- I18n.t('oauth_client.errors.oauth_code_not_present_explanation')]+ flash[:error] = [I18n.t("oauth_client.errors.oauth_code_not_present"),+ I18n.t("oauth_client.errors.oauth_code_not_present_explanation")]redirect_user_or_admin(get_redirect_uri) do# If the current user is an admin, we send her directly to the@@ -164,8 +161,8 @@ class OAuthClientsController < ApplicationControllerelse# To protect against CSRF we cancel this request. There was either no# state parameter given, or there was no corresponding cookie present.- flash[:error] = [I18n.t('oauth_client.errors.oauth_state_not_present'),- I18n.t('oauth_client.errors.oauth_state_not_present_explanation')]+ flash[:error] = [I18n.t("oauth_client.errors.oauth_state_not_present"),+ I18n.t("oauth_client.errors.oauth_state_not_present_explanation")]redirect_user_or_admin(nil) do# Guide the user to the settings that she needs to edit/fix.@@ -200,11 +197,11 @@ class OAuthClientsController < ApplicationController# This happens during admin setup if the user forgot to update the return_uri# on the Authorization Server (i.e. Nextcloud) after updating the OpenProject# side with a new client_id and client_secret.- flash[:error] = [I18n.t('oauth_client.errors.oauth_client_not_found'),- I18n.t('oauth_client.errors.oauth_client_not_found_explanation')]+ flash[:error] = [I18n.t("oauth_client.errors.oauth_client_not_found"),+ I18n.t("oauth_client.errors.oauth_client_not_found_explanation")]redirect_user_or_admin(get_redirect_uri) do- # Something must be wrong in the storage's setup+ # Something must be wrong in the storage"s setupredirect_to admin_settings_storages_pathendend@@ -217,7 +214,7 @@ class OAuthClientsController < ApplicationControllerif User.current.admin && redirect_uri && (nextcloud? || one_drive?)yieldelsif redirect_uri- flash[:error] = [t(:'oauth_client.errors.oauth_issue_contact_admin')]+ flash[:error] = [t(:"oauth_client.errors.oauth_issue_contact_admin")]redirect_to redirect_urielseredirect_to root_urldiff --git a/modules/storages/app/controllers/storages/admin/project_storages_controller.rb b/modules/storages/app/controllers/storages/admin/project_storages_controller.rbindex 890f7307b04..9f97c9e249a 100644--- a/modules/storages/app/controllers/storages/admin/project_storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/project_storages_controller.rb@@ -60,6 +60,7 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsController# Show a HTML page with a form in order to create a new ProjectStorage# Called by: When a user clicks on the "+New" button in Project -> Settings -> File Storages+ # rubocop:disable Metrics/AbcSizedef new@available_storages = available_storagesproject_folder_mode = Storages::ProjectStorage.project_folder_modes.values.find do |mode|@@ -76,6 +77,8 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsControllerrender template: "/storages/project_settings/new"end+ # rubocop:enable Metrics/AbcSize+# Create a new ProjectStorage object.# Called by: The new page above with form-data from that form.def create@@ -113,7 +116,7 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsControllerendend- # Edit page is very similar to new page, except that we don"t need to set+ # Edit page is very similar to new page, except that we don't need to set# default attribute values because the object already exists# Called by: Global app/config/routes.rb to serve Web pagedef edit@@ -149,7 +152,7 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsControllerend# Purpose: Destroy a ProjectStorage object- # Called by: By pressing a "Delete" icon in the Project"s settings ProjectStorages page+ # Called by: By pressing a "Delete" icon in the Project's settings ProjectStorages page# It redirects back to the list of ProjectStorages in the projectdef destroy# The complex logic for deleting associated objects was moved into a service:diff --git a/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb b/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rbindex 31011698613..fccff3ac72d 100644--- a/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb@@ -26,10 +26,10 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"require_module_spec_helper-RSpec.describe 'API v3 storages resource', :webmock, content_type: :json do+RSpec.describe "API v3 storages resource", :webmock, content_type: :json doinclude API::V3::Utilities::PathHelperinclude StorageServerHelpersinclude UserPermissionsHelper@@ -42,9 +42,7 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json doendshared_let(:user_without_project) { create(:user) }shared_let(:admin) { create(:admin) }- shared_let(:oauth_application) { create(:oauth_application) }- shared_let(:oauth_client) { create(:oauth_client) }- shared_let(:storage) { create(:nextcloud_storage, creator: user_with_permissions, oauth_application:, oauth_client:) }+ shared_let(:storage) { create(:nextcloud_storage_configured, creator: user_with_permissions) }shared_let(:project_storage) { create(:project_storage, project:, storage:) }let(:current_user) { user_with_permissions }@@ -55,65 +53,61 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json doendbefore do- Storages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",- ->(_) { auth_check_result }- )-+ Storages::Peripherals::Registry.stub("nextcloud.queries.auth_check", ->(_) { auth_check_result })login_as current_userend- shared_examples_for 'successful storage response' do |as_admin: false|- include_examples 'successful response'+ shared_examples_for "successful storage response" do |as_admin: false|+ include_examples "successful response"- describe 'response body' do+ describe "response body" dosubject { last_response.body }- it { is_expected.to be_json_eql('Storage'.to_json).at_path('_type') }- it { is_expected.to be_json_eql(storage.id.to_json).at_path('id') }+ it { is_expected.to be_json_eql("Storage".to_json).at_path("_type") }+ it { is_expected.to be_json_eql(storage.id.to_json).at_path("id") }if as_admin- it { is_expected.to have_json_path('_embedded/oauthApplication') }+ it { is_expected.to have_json_path("_embedded/oauthApplication") }else- it { is_expected.not_to have_json_path('_embedded/oauthApplication') }+ it { is_expected.not_to have_json_path("_embedded/oauthApplication") }endendend- describe 'GET /api/v3/storages' do+ describe "GET /api/v3/storages" dolet(:path) { api_v3_paths.storages }let!(:another_storage) { create(:nextcloud_storage) }subject(:last_response) { get path }- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- describe 'gets the storage collection and returns it' do+ describe "gets the storage collection and returns it" dosubject { last_response.body }- it_behaves_like 'API V3 collection response', 2, 2, 'Storage', 'Collection' do+ it_behaves_like "API V3 collection response", 2, 2, "Storage", "Collection" dolet(:elements) { [another_storage, storage] }endendend- context 'as non-admin' do- describe 'gets the storage collection of storages linked to visible projects with correct permissions' do+ context "as non-admin" do+ describe "gets the storage collection of storages linked to visible projects with correct permissions" dosubject { last_response.body }- it_behaves_like 'API V3 collection response', 1, 1, 'Storage', 'Collection' do+ it_behaves_like "API V3 collection response", 1, 1, "Storage", "Collection" dolet(:elements) { [storage] }endendendend- describe 'POST /api/v3/storages' do+ describe "POST /api/v3/storages" dolet(:path) { api_v3_paths.storages }- let(:host) { 'https://example.nextcloud.local' }- let(:name) { 'APIStorage' }- let(:type) { 'urn:openproject-org:api:v3:storages:Nextcloud' }+ let(:host) { "https://example.nextcloud.local" }+ let(:name) { "APIStorage" }+ let(:type) { "urn:openproject-org:api:v3:storages:Nextcloud" }let(:params) do{name:,@@ -134,32 +128,32 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json dopost path, params.to_jsonend- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- describe 'creates a storage and returns it' do+ describe "creates a storage and returns it" dosubject { last_response.body }- it_behaves_like 'successful response', 201+ it_behaves_like "successful response", 201- it { is_expected.to have_json_path('_embedded/oauthApplication/clientSecret') }+ it { is_expected.to have_json_path("_embedded/oauthApplication/clientSecret") }end- context 'with applicationPassword' do+ context "with applicationPassword" dolet(:params) dosuper().merge(- applicationPassword: 'myappsecret'+ applicationPassword: "myappsecret")endsubject { last_response.body }- it_behaves_like 'successful response', 201+ it_behaves_like "successful response", 201- it { is_expected.to be_json_eql('true').at_path('hasApplicationPassword') }+ it { is_expected.to be_json_eql("true").at_path("hasApplicationPassword") }end- context 'with applicationPassword as null' do+ context "with applicationPassword as null" dolet(:params) dosuper().merge(applicationPassword: nil@@ -168,164 +162,164 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json dosubject { last_response.body }- it_behaves_like 'successful response', 201+ it_behaves_like "successful response", 201- it { is_expected.to be_json_eql('false').at_path('hasApplicationPassword') }+ it { is_expected.to be_json_eql("false").at_path("hasApplicationPassword") }end- context 'if missing a mandatory value' do+ context "if missing a mandatory value" dolet(:params) do{- name: 'APIStorage',+ name: "APIStorage",_links: {- type: { href: 'urn:openproject-org:api:v3:storages:Nextcloud' }+ type: { href: "urn:openproject-org:api:v3:storages:Nextcloud" }}}end- it_behaves_like 'constraint violation' do+ it_behaves_like "constraint violation" dolet(:message) { "Host is not a valid URL" }endendend- context 'as non-admin' do- it_behaves_like 'unauthorized access'+ context "as non-admin" do+ it_behaves_like "unauthorized access"endend- describe 'GET /api/v3/storages/:storage_id' do+ describe "GET /api/v3/storages/:storage_id" dolet(:path) { api_v3_paths.storage(storage.id) }- context 'if user belongs to a project using the given storage' do+ context "if user belongs to a project using the given storage" dosubject { last_response.body }- it_behaves_like 'successful storage response'+ it_behaves_like "successful storage response"- context 'if user is missing permission view_file_links' do+ context "if user is missing permission view_file_links" dobefore(:all) { remove_permissions(user_with_permissions, :view_file_links) }after(:all) { add_permissions(user_with_permissions, :view_file_links) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if no storage with that id exists' do+ context "if no storage with that id exists" dolet(:path) { api_v3_paths.storage(1337) }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- context 'if user has :manage_storages_in_project permission in any project' do+ context "if user has :manage_storages_in_project permission in any project" dolet(:permissions) { %i(manage_storages_in_project) }- it_behaves_like 'successful storage response'+ it_behaves_like "successful storage response"end- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- it_behaves_like 'successful storage response', as_admin: true+ it_behaves_like "successful storage response", as_admin: truesubject { last_response.body }- it { is_expected.not_to have_json_path('_embedded/oauthApplication/clientSecret') }+ it { is_expected.not_to have_json_path("_embedded/oauthApplication/clientSecret") }end- context 'when OAuth authorization server is involved' do- shared_examples 'a storage authorization result' do |expected:, has_authorize_link:|+ context "when OAuth authorization server is involved" do+ shared_examples "a storage authorization result" do |expected:, has_authorize_link:|subject { last_response.body }it "returns #{expected}" do- expect(subject).to be_json_eql(expected.to_json).at_path('_links/authorizationState/href')+ expect(subject).to be_json_eql(expected.to_json).at_path("_links/authorizationState/href")endit "has #{has_authorize_link ? '' : 'no'} authorize link" doif has_authorize_link- expect(subject).to have_json_path('_links/authorize/href')+ expect(subject).to have_json_path("_links/authorize/href")else- expect(subject).not_to have_json_path('_links/authorize/href')+ expect(subject).not_to have_json_path("_links/authorize/href")endendend- context 'when authorization succeeds and storage is connected' do+ context "when authorization succeeds and storage is connected" dolet(:auth_check_result) { ServiceResult.success }- include_examples 'a storage authorization result',+ include_examples "a storage authorization result",expected: API::V3::Storages::URN_CONNECTION_CONNECTED,has_authorize_link: falseend- context 'when authorization fails' do+ context "when authorization fails" dolet(:auth_check_result) { ServiceResult.failure(errors: Storages::StorageError.new(code: :unauthorized)) }- include_examples 'a storage authorization result',+ include_examples "a storage authorization result",expected: API::V3::Storages::URN_CONNECTION_AUTH_FAILED,has_authorize_link: trueend- context 'when authorization fails with an error' do+ context "when authorization fails with an error" dolet(:auth_check_result) { ServiceResult.failure(errors: Storages::StorageError.new(code: :error)) }- include_examples 'a storage authorization result',+ include_examples "a storage authorization result",expected: API::V3::Storages::URN_CONNECTION_ERROR,has_authorize_link: falseendendend- describe 'PATCH /api/v3/storages/:storage_id' do+ describe "PATCH /api/v3/storages/:storage_id" dolet(:path) { api_v3_paths.storage(storage.id) }- let(:name) { 'A new storage name' }+ let(:name) { "A new storage name" }let(:params) { { name: } }subject(:last_response) dopatch path, params.to_jsonend- context 'as non-admin' do- context 'if user belongs to a project using the given storage' do- it_behaves_like 'unauthorized access'+ context "as non-admin" do+ context "if user belongs to a project using the given storage" do+ it_behaves_like "unauthorized access"end- context 'if user does not belong to a project using the given storage' do+ context "if user does not belong to a project using the given storage" dolet(:current_user) { user_without_project }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- describe 'patches the storage and returns it' do+ describe "patches the storage and returns it" dosubject { last_response.body }- it_behaves_like 'successful response'+ it_behaves_like "successful response"- it { is_expected.to be_json_eql(name.to_json).at_path('name') }+ it { is_expected.to be_json_eql(name.to_json).at_path("name") }end- context 'with applicationPassword' do+ context "with applicationPassword" dolet(:params) dosuper().merge(- applicationPassword: 'myappsecret'+ applicationPassword: "myappsecret")endbefore do- mock_nextcloud_application_credentials_validation(storage.host, password: 'myappsecret')+ mock_nextcloud_application_credentials_validation(storage.host, password: "myappsecret")endsubject { last_response.body }- it_behaves_like 'successful response'+ it_behaves_like "successful response"- it { is_expected.to be_json_eql('true').at_path('hasApplicationPassword') }+ it { is_expected.to be_json_eql("true").at_path("hasApplicationPassword") }end- context 'with applicationPassword as null' do+ context "with applicationPassword as null" dolet(:params) dosuper().merge(applicationPassword: nil@@ -334,30 +328,30 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json dosubject { last_response.body }- it_behaves_like 'successful response'+ it_behaves_like "successful response"- it { is_expected.to be_json_eql('false').at_path('hasApplicationPassword') }+ it { is_expected.to be_json_eql("false").at_path("hasApplicationPassword") }end- context 'with invalid applicationPassword' do+ context "with invalid applicationPassword" dolet(:params) dosuper().merge(- applicationPassword: '123'+ applicationPassword: "123")endbefore do- mock_nextcloud_application_credentials_validation(storage.host, password: '123', response_code: 401)+ mock_nextcloud_application_credentials_validation(storage.host, password: "123", response_code: 401)endsubject { last_response.body }- it { is_expected.to be_json_eql('Password is not valid.'.to_json).at_path('message') }+ it { is_expected.to be_json_eql("Password is not valid.".to_json).at_path("message") }endendend- describe 'DELETE /api/v3/storages/:storage_id' do+ describe "DELETE /api/v3/storages/:storage_id" dolet(:path) { api_v3_paths.storage(storage.id) }let(:delete_folder_url) do"#{storage.host}/remote.php/dav/files/#{storage.username}/#{project_storage.managed_project_folder_path.chop}/"@@ -374,72 +368,72 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json dodeletion_request_stubend- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- it_behaves_like 'successful no content response'+ it_behaves_like "successful no content response"end- context 'as non-admin' do- context 'if user belongs to a project using the given storage' do- it_behaves_like 'unauthorized access'+ context "as non-admin" do+ context "if user belongs to a project using the given storage" do+ it_behaves_like "unauthorized access"- it 'does not request project folder deletion' do+ it "does not request project folder deletion" doexpect(deletion_request_stub).not_to have_been_requestedendend- context 'if user does not belong to a project using the given storage' do+ context "if user does not belong to a project using the given storage" dolet(:current_user) { user_without_project }- it_behaves_like 'not found'+ it_behaves_like "not found"- it 'does not request project folder deletion' do+ it "does not request project folder deletion" doexpect(deletion_request_stub).not_to have_been_requestedendendendend- describe 'GET /api/v3/storages/:storage_id/open' do+ describe "GET /api/v3/storages/:storage_id/open" dolet(:path) { api_v3_paths.storage_open(storage.id) }- let(:location) { 'https://deathstar.storage.org/files' }+ let(:location) { "https://deathstar.storage.org/files" }before doStorages::Peripherals::Registry.stub(- 'nextcloud.queries.open_storage',+ "nextcloud.queries.open_storage",->(_) { ServiceResult.success(result: location) })end- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- it_behaves_like 'redirect response'+ it_behaves_like "redirect response"end- context 'if user belongs to a project using the given storage' do- it_behaves_like 'redirect response'+ context "if user belongs to a project using the given storage" do+ it_behaves_like "redirect response"- context 'if user is missing permission view_file_links' do+ context "if user is missing permission view_file_links" dobefore(:all) { remove_permissions(user_with_permissions, :view_file_links) }after(:all) { add_permissions(user_with_permissions, :view_file_links) }- it_behaves_like 'not found'+ it_behaves_like "not found"end- context 'if no storage with that id exists' do- let(:path) { api_v3_paths.storage_open('1337') }+ context "if no storage with that id exists" do+ let(:path) { api_v3_paths.storage_open("1337") }- it_behaves_like 'not found'+ it_behaves_like "not found"endendend- describe 'POST /api/v3/storages/:storage_id/oauth_client_credentials' do+ describe "POST /api/v3/storages/:storage_id/oauth_client_credentials" dolet(:path) { api_v3_paths.storage_oauth_client_credentials(storage.id) }- let(:client_id) { 'myl1ttlecl13ntidii' }- let(:client_secret) { 'th3v3rys3cr3tcl13nts3cr3t' }+ let(:client_id) { "myl1ttlecl13ntidii" }+ let(:client_secret) { "th3v3rys3cr3tcl13nts3cr3t" }let(:params) do{clientId: client_id,@@ -451,41 +445,41 @@ RSpec.describe 'API v3 storages resource', :webmock, content_type: :json dopost path, params.to_jsonend- context 'as non-admin' do- context 'if user belongs to a project using the given storage' do- it_behaves_like 'unauthorized access'+ context "as non-admin" do+ context "if user belongs to a project using the given storage" do+ it_behaves_like "unauthorized access"end- context 'if user does not belong to a project using the given storage' do+ context "if user does not belong to a project using the given storage" dolet(:current_user) { user_without_project }- it_behaves_like 'not found'+ it_behaves_like "not found"endend- context 'as admin' do+ context "as admin" dolet(:current_user) { admin }- describe 'creates new oauth client secrets' do+ describe "creates new oauth client secrets" dosubject { last_response.body }- it_behaves_like 'successful response', 201+ it_behaves_like "successful response", 201- it { is_expected.to be_json_eql('OAuthClientCredentials'.to_json).at_path('_type') }- it { is_expected.to be_json_eql(client_id.to_json).at_path('clientId') }- it { is_expected.to be_json_eql(true.to_json).at_path('confidential') }- it { is_expected.not_to have_json_path('clientSecret') }+ it { is_expected.to be_json_eql("OAuthClientCredentials".to_json).at_path("_type") }+ it { is_expected.to be_json_eql(client_id.to_json).at_path("clientId") }+ it { is_expected.to be_json_eql(true.to_json).at_path("confidential") }+ it { is_expected.not_to have_json_path("clientSecret") }end- context 'if request body is invalid' do+ context "if request body is invalid" dolet(:params) do{- clientSecret: 'only_an_id'+ clientSecret: "only_an_id"}end- it_behaves_like 'constraint violation' do- let(:message) { 'Client ID can\'t be blank.' }+ it_behaves_like "constraint violation" do+ let(:message) { "Client ID can't be blank." }endendenddiff --git a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rbindex 86647c0c511..41f5f901ede 100644--- a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb+++ b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb@@ -62,7 +62,7 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_accontext "when user is logged in" dobefore { login_as(user) }- context 'when user is not "connected"' do+ context "when user is not 'connected'" dolet(:nonce) { "57a17c3f-b2ed-446e-9dd8-651ba3aec37d" }let(:redirect_uri) doCGI.escape("#{OpenProject::Application.root_url}/oauth_clients/#{storage.oauth_client.client_id}/callback")@@ -90,19 +90,11 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_acendend- context 'when user is "connected"' do+ context "when user is 'connected'" doshared_let(:oauth_client_token) { create(:oauth_client_token, oauth_client: storage.oauth_client, user:) }before do- oauth_client_token- stub_request(:get, "#{storage.host}/ocs/v1.php/cloud/user")- .with(- headers: {- "Accept" => "application/json",- "Authorization" => "Bearer #{oauth_client_token.access_token}",- "Ocs-Apirequest" => "true"- }- ).to_return(status: 200, body: "", headers: {})+ Storages::Peripherals::Registry.stub("nextcloud.queries.auth_check", ->(_) { ServiceResult.success })endit "redirects to destination_url" do