diff --git a/app/services/service_provider_updater.rb b/app/services/service_provider_updater.rb index ab878f9b16d..ccece2020ee 100644 --- a/app/services/service_provider_updater.rb +++ b/app/services/service_provider_updater.rb @@ -3,7 +3,6 @@ class ServiceProviderUpdater SP_PROTECTED_ATTRIBUTES = %i[ created_at id - native updated_at ].to_set.freeze @@ -34,13 +33,12 @@ def update_cache(service_provider) if service_provider['active'] == true create_or_update_service_provider(issuer, service_provider) else - ServiceProvider.where(issuer: issuer, native: false).destroy_all + ServiceProvider.where(issuer: issuer).destroy_all end end def create_or_update_service_provider(issuer, service_provider) sp = ServiceProvider.find_by(issuer: issuer) - return if sp&.native? sync_model(sp, cleaned_service_provider(service_provider)) end diff --git a/spec/services/service_provider_updater_spec.rb b/spec/services/service_provider_updater_spec.rb index 157d873f61f..5706e7b8f56 100644 --- a/spec/services/service_provider_updater_spec.rb +++ b/spec/services/service_provider_updater_spec.rb @@ -27,7 +27,6 @@ block_encryption: 'aes256-cbc', certs: [saml_test_sp_cert], active: true, - native: false, approved: true, help_text: { sign_in: { en: 'A new different sign-in help text' }, @@ -105,7 +104,6 @@ expect(sp.id).to_not eq 0 expect(sp.updated_at).to_not eq friendly_sp[:updated_at] expect(sp.created_at).to_not eq friendly_sp[:created_at] - expect(sp.native).to eq false expect(sp.approved).to eq true expect(sp.help_text['sign_in']).to eq friendly_sp[:help_text][:sign_in]. stringify_keys @@ -129,7 +127,6 @@ expect(sp.id).to eq old_id expect(sp.updated_at).to_not eq friendly_sp[:updated_at] expect(sp.created_at).to_not eq friendly_sp[:created_at] - expect(sp.native).to eq false expect(sp.approved).to eq true expect(sp.help_text['sign_in']).to eq friendly_sp[:help_text][:sign_in]. stringify_keys @@ -184,7 +181,7 @@ end end - context 'a non-native service provider is invalid' do + context 'a service provider is invalid' do let(:dashboard_service_providers) do [ { @@ -200,7 +197,6 @@ block_encryption: 'aes256-cbc', certs: [saml_test_sp_cert], active: true, - native: false, approved: true, redirect_uris: [''], }, @@ -294,25 +290,12 @@ let(:sp) { create(:service_provider, issuer: attributes[:issuer]) } before { attributes[:active] = false } - context 'it is not a native service provider' do - it 'destroys the service_provider' do - subject.run(attributes) - - destroyed_sp = ServiceProvider.find_by(issuer: attributes[:issuer]) - - expect(destroyed_sp).to be nil - end - end - - context 'it is a native service provider' do - before { sp.update!(native: true) } - it 'is not destroyed' do - subject.run(attributes) + it 'destroys the service_provider' do + subject.run(attributes) - destroyed_sp = ServiceProvider.find_by(issuer: attributes[:issuer]) + destroyed_sp = ServiceProvider.find_by(issuer: attributes[:issuer]) - expect(destroyed_sp).to eq sp - end + expect(destroyed_sp).to be nil end end end