Skip to content

Commit eae6ee1

Browse files
Merge pull request opf#18068 from opf/redirect-uri-completed
Make sure redirect URI does not show as completed prematurely
2 parents 8ab47a1 + 21db435 commit eae6ee1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

modules/storages/app/components/storages/admin/redirect_uri_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'storage-redirect-uri-label')
88
) { I18n.t('storages.file_storage_view.redirect_uri') }
99
)
10-
concat(configuration_check_label_for(:storage_oauth_client_configured))
10+
concat(configuration_check_label_for(:storage_redirect_uri_configured))
1111
end
1212

1313
grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-redirect-uri-description') do

modules/storages/app/models/storages/one_drive_storage.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class OneDriveStorage < Storage
4242
def configuration_checks
4343
{
4444
storage_oauth_client_configured: oauth_client.present?,
45+
storage_redirect_uri_configured: oauth_client&.persisted?,
4546
storage_tenant_drive_configured: tenant_id.present? && drive_id.present?,
4647
access_management_configured: !automatic_management_unspecified?,
4748
name_configured: name.present?

modules/storages/spec/models/storages/one_drive_storage_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@
4343

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

4848
it "returns true" do
49-
expect(storage.configured?).to be(true)
49+
expect(storage).to be_configured
5050

5151
aggregate_failures "configuration_checks" do
5252
expect(storage.configuration_checks)
5353
.to eq(name_configured: true,
5454
storage_oauth_client_configured: true,
5555
access_management_configured: true,
56+
storage_redirect_uri_configured: true,
5657
storage_tenant_drive_configured: true)
5758
end
5859
end
@@ -62,10 +63,11 @@
6263
let(:storage) { build(:one_drive_storage) }
6364

6465
it "returns false" do
65-
expect(storage.configured?).to be(false)
66+
expect(storage).not_to be_configured
6667

6768
aggregate_failures "configuration_checks" do
68-
expect(storage.configuration_checks[:storage_oauth_client_configured]).to be(false)
69+
expect(storage.configuration_checks[:storage_oauth_client_configured]).to be_falsey
70+
expect(storage.configuration_checks[:storage_redirect_uri_configured]).to be_falsey
6971
end
7072
end
7173
end

0 commit comments

Comments
 (0)