Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure redirect URI does not show as completed prematurely #18068

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'storage-redirect-uri-label')
) { I18n.t('storages.file_storage_view.redirect_uri') }
)
concat(configuration_check_label_for(:storage_oauth_client_configured))
concat(configuration_check_label_for(:storage_redirect_uri_configured))
end

grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-redirect-uri-description') do
Expand Down
1 change: 1 addition & 0 deletions modules/storages/app/models/storages/one_drive_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class OneDriveStorage < Storage
def configuration_checks
{
storage_oauth_client_configured: oauth_client.present?,
storage_redirect_uri_configured: oauth_client&.persisted?,
storage_tenant_drive_configured: tenant_id.present? && drive_id.present?,
access_management_configured: !automatic_management_unspecified?,
name_configured: name.present?
Expand Down
10 changes: 6 additions & 4 deletions modules/storages/spec/models/storages/one_drive_storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@

describe "#configured?" do
context "with a complete configuration" do
let(:storage) { build(:one_drive_storage, :as_not_automatically_managed, oauth_client: build(:oauth_client)) }
let(:storage) { create(:one_drive_storage, :as_not_automatically_managed, oauth_client: build(:oauth_client)) }

it "returns true" do
expect(storage.configured?).to be(true)
expect(storage).to be_configured

aggregate_failures "configuration_checks" do
expect(storage.configuration_checks)
.to eq(name_configured: true,
storage_oauth_client_configured: true,
access_management_configured: true,
storage_redirect_uri_configured: true,
storage_tenant_drive_configured: true)
end
end
Expand All @@ -62,10 +63,11 @@
let(:storage) { build(:one_drive_storage) }

it "returns false" do
expect(storage.configured?).to be(false)
expect(storage).not_to be_configured

aggregate_failures "configuration_checks" do
expect(storage.configuration_checks[:storage_oauth_client_configured]).to be(false)
expect(storage.configuration_checks[:storage_oauth_client_configured]).to be_falsey
expect(storage.configuration_checks[:storage_redirect_uri_configured]).to be_falsey
end
end
end
Expand Down
Loading