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
[#53718] added and adapted unit tests
Eric Schubertb0c27c09fea2
diff --git a/modules/storages/app/components/storages/admin/access_management_component.html.erb b/modules/storages/app/components/storages/admin/access_management_component.html.erbindex 0f5d8991321..fad5d11eebc 100644--- a/modules/storages/app/components/storages/admin/access_management_component.html.erb+++ b/modules/storages/app/components/storages/admin/access_management_component.html.erb@@ -1,5 +1,8 @@<%=- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid_layout('op-storage-view--row',+ tag: :div,+ test_selector: 'storage-access-management-section',+ align_items: :center) do |grid|grid.with_area(:item, tag: :div, mr: 3) doconcat(render(Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'access-management-label')) doI18n.t('storages.file_storage_view.access_management.subtitle')diff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rbindex 794aeaa620e..76d20c4aac3 100644--- a/modules/storages/app/models/storages/one_drive_storage.rb+++ b/modules/storages/app/models/storages/one_drive_storage.rb@@ -43,7 +43,8 @@ module Storages{storage_oauth_client_configured: oauth_client.present?,storage_tenant_drive_configured: tenant_id.present? && drive_id.present?,- host_name_configured: name.present?+ access_management_configured: !automatic_management_unspecified?,+ name_configured: name.present?}enddiff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex e0acc1e502e..dfbaa453e64 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -79,10 +79,10 @@ en:error_invalid_provider_type: Please select a valid storage provider.file_storage_view:access_management:- automatic_management: Automatically managed access and folders+ automatic_management: Automatically managed access and folders.automatic_management_description: Let OpenProject create folders per project automatically and manage its user access. This is recommended as it ensures that every team member has always the correct access permissions.description: Select the type of management of user access and folder creation. We recommend to use the Automatically managed access to have a more organised structure and guarantee access to all relevant users.- manual_management: Manually managed access and folders+ manual_management: Manually managed access and folders.manual_management_description: Create and manage folders per project manually on your own. You will need to manually ensure relevant users have access.setup_incomplete: Select the type of management of user access and folder creation.subtitle: Access managementdiff --git a/modules/storages/spec/components/storages/admin/access_management_component_spec.rb b/modules/storages/spec/components/storages/admin/access_management_component_spec.rbnew file mode 100644index 00000000000..9eb73321400--- /dev/null+++ b/modules/storages/spec/components/storages/admin/access_management_component_spec.rb@@ -0,0 +1,67 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 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::Admin::AccessManagementComponent, type: :component do+ subject(:access_management_component) { described_class.new(storage) }++ before do+ render_inline(access_management_component)+ end++ context "on a pristine form" do+ let(:storage) { Storages::OneDriveStorage.new }++ it "renders the access management description" do+ expect(page).to have_text("Select the type of management of user access and folder creation.")+ expect(page).not_to have_test_selector("label-access_management_configured-status")+ end+ end++ context "on a form with access management set to automatic management enabled" do+ let(:storage) { create(:one_drive_storage, :as_automatically_managed) }++ it "renders the access management description" do+ expect(page).to have_text("Automatically managed access and folders.")+ expect(page).to have_test_selector("label-access_management_configured-status", text: "Completed")+ end+ end++ context "on a form with access management set to manual management enabled" do+ let(:storage) { create(:one_drive_storage, :as_not_automatically_managed) }++ it "renders the access management description" do+ expect(page).to have_text("Manually managed access and folders.")+ expect(page).to have_test_selector("label-access_management_configured-status", text: "Completed")+ end+ end+enddiff --git a/modules/storages/spec/models/storages/one_drive_storage_spec.rb b/modules/storages/spec/models/storages/one_drive_storage_spec.rbindex dfbdd1cf64b..e8cc7df6b7e 100644--- a/modules/storages/spec/models/storages/one_drive_storage_spec.rb+++ b/modules/storages/spec/models/storages/one_drive_storage_spec.rb@@ -43,15 +43,16 @@ RSpec.describe Storages::OneDriveStorage dodescribe "#configured?" docontext "with a complete configuration" do- let(:storage) { build(:one_drive_storage, oauth_client: build(:oauth_client)) }+ let(:storage) { build(:one_drive_storage, :as_not_automatically_managed, oauth_client: build(:oauth_client)) }it "returns true" doexpect(storage.configured?).to be(true)aggregate_failures "configuration_checks" doexpect(storage.configuration_checks)- .to eq(host_name_configured: true,+ .to eq(name_configured: true,storage_oauth_client_configured: true,+ access_management_configured: true,storage_tenant_drive_configured: true)endend