save api particulier scopes

This commit is contained in:
simon lehericey 2021-09-08 16:34:04 +02:00
parent 6c6205e188
commit 1d06c15ac0
2 changed files with 3 additions and 1 deletions

View file

@ -18,7 +18,8 @@ module NewAdministrateur
flash.now.alert = t('.no_scopes_token')
render :show
else
@procedure.save
@procedure.api_particulier_scopes = scopes
@procedure.save!
redirect_to admin_procedure_api_particulier_jeton_path(procedure_id: @procedure.id),
notice: t('.token_ok')

View file

@ -44,6 +44,7 @@ describe NewAdministrateur::JetonParticulierController, type: :controller do
it { expect(flash.alert).to be_nil }
it { expect(flash.notice).to eq("Le jeton a bien été mis à jour") }
it { expect(procedure.reload.api_particulier_token).to eql(token) }
it { expect(procedure.reload.api_particulier_scopes).to contain_exactly("dgfip_avis_imposition", "dgfip_adresse", "cnaf_allocataires", "cnaf_enfants", "cnaf_adresse", "cnaf_quotient_familial", "mesri_statut_etudiant") }
end
context "and the api response is a success but with an empty scopes" do