diff --git a/config/authorization_request_forms/api_particulier.yml b/config/authorization_request_forms/api_particulier.yml index ccf9962342..44b5e35265 100644 --- a/config/authorization_request_forms/api_particulier.yml +++ b/config/authorization_request_forms/api_particulier.yml @@ -65,6 +65,7 @@ api-particulier-familea: &api_particulier_familea - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Domino web 2.0 | Gestion des structures de petites enfances, enfance et jeunesse description: | @@ -119,6 +120,7 @@ api-particulier-arpege-concerto: displayed: - cnaf_quotient_familial - cnaf_allocataires + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification sur Quotient Familial des prestations Périscolaire description: | @@ -154,6 +156,7 @@ api-particulier-cantine-de-france: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération du Quotient Familial ainsi que les informations administratives @@ -196,6 +199,7 @@ api-particulier-agora-plus: - cnaf_quotient_familial - cnaf_allocataires - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Dématérialisation du calcul du quotient/taux d'effort pour les structures @@ -236,6 +240,7 @@ api-particulier-amiciel-malice: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: @@ -345,6 +350,7 @@ api-particulier-city-family-mushroom-software: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Calcul du quotient familial pour la facturations des crèches, du périscolaire, du scolaire et de l’extrascolaire description: Gestion des activités enfance, jeunesse, petite enfance (facturations des crèches, du périscolaire, du scolaire et de l’extrascolaire). Portail famille et back-office @@ -392,6 +398,7 @@ api-particulier-civil-enfance-ciril-group: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape # Scopes FranceConnect - family_name @@ -434,6 +441,7 @@ api-particulier-cosoluce-fluo: - cnaf_quotient_familial displayed: - cnaf_quotient_familial + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération des données CNAF pour les services municipaux description: Logiciel utilisé par des agents habilités pour la facturation des cantines @@ -466,6 +474,7 @@ api-particulier-nfi: - cnaf_allocataires - cnaf_adresse - cnaf_enfants + - cnav_allocation_enfant_handicape initialize_with: intitule: Gestion de la relation client sur le portail famille description: | @@ -500,6 +509,7 @@ api-particulier-technocarte-ile: displayed: - cnaf_quotient_familial - cnaf_allocataires + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération du Quotient Familial pour le service Enfance (Périscolaire, @@ -543,6 +553,7 @@ api-particulier-waigeo-myperischool: - cnaf_allocataires - cnaf_adresse - cnaf_enfants + - cnav_allocation_enfant_handicape # Scopes FranceConnect - family_name @@ -585,6 +596,7 @@ api-particulier-3d-ouest: displayed: - cnaf_quotient_familial - cnaf_allocataires + - cnav_allocation_enfant_handicape initialize_with: intitule: @@ -627,6 +639,7 @@ api-particulier-agedi-proxima-enf: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification service enfance et récupération des quotients familiaux @@ -668,6 +681,7 @@ api-particulier-ecorestauration-loyfeey: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification sur Quotient Familial des cantines @@ -707,6 +721,7 @@ api-particulier-jcdeveloppement-familyclic: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification sur Quotient Familial des cantines @@ -749,6 +764,7 @@ api-particulier-aiga: - openid displayed: - cnaf_quotient_familial + - cnav_allocation_enfant_handicape # Scopes FranceConnect - family_name @@ -1091,6 +1107,7 @@ api-particulier-bl-enfance-berger-levrault: - cnaf_quotient_familial displayed: - cnaf_quotient_familial + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification sur Quotient Familial des activités scolaires, périscolaires et loisirs description: | @@ -1125,6 +1142,7 @@ api-particulier-noethys: - cnaf_allocataires - cnaf_adresse - cnaf_enfants + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération du Quotient Familial pour le service enfance (Périscolaire, centre de loisirs) description: | @@ -1159,6 +1177,7 @@ api-particulier-carte-plus: - cnaf_allocataires - cnaf_adresse - cnaf_enfants + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération du Quotient Familial pour le service enfance (Périscolaire, centre de loisirs) description: | @@ -1198,6 +1217,7 @@ api-particulier-resagenda: - cnaf_allocataires - cnaf_adresse - cnaf_enfants + - cnav_allocation_enfant_handicape initialize_with: intitule: Récupération du Quotient Familial pour le service enfance (Périscolaire, centre de loisirs) description: | @@ -1281,6 +1301,7 @@ api-particulier-jvs-mairistem: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Facturation des familles pour les services périscolaires et loisirs @@ -1373,6 +1394,7 @@ api-particulier-ypok-ykidz: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape # Scopes FranceConnect - family_name @@ -1446,6 +1468,7 @@ api-particulier-e1os: - cnaf_quotient_familial displayed: - cnaf_quotient_familial + - cnav_allocation_enfant_handicape initialize_with: intitule: Facturation des familles pour les services scolaire et cantine @@ -1476,6 +1499,7 @@ api-particulier-acheteza: - cnaf_quotient_familial displayed: - cnaf_quotient_familial + - cnav_allocation_enfant_handicape initialize_with: intitule: Facturation des familles pour les services scolaire et cantine @@ -1902,6 +1926,7 @@ api-particulier-entrouvert-publik: - cnaf_quotient_familial - cnaf_allocataires - cnaf_enfants + - cnav_allocation_enfant_handicape # Scopes FranceConnect - family_name @@ -2888,6 +2913,7 @@ api-particulier-andyvie: - cnaf_allocataires - cnaf_enfants - cnaf_adresse + - cnav_allocation_enfant_handicape initialize_with: intitule: Tarification des services municipaux à l’enfance description: | diff --git a/spec/acceptance/authorizations_configs_spec.rb b/spec/acceptance/authorizations_configs_spec.rb index e4f3d68123..bbf2a0de7e 100644 --- a/spec/acceptance/authorizations_configs_spec.rb +++ b/spec/acceptance/authorizations_configs_spec.rb @@ -38,4 +38,38 @@ def block_exists?(kind, name) end end end + + describe 'AEEH scope on tarification municipale enfance editor forms' do + subject(:editor_forms) do + AuthorizationRequestForm.all.select do |form| + form.use_case.to_s == 'tarification_municipale_enfance' && form.service_provider.present? + end + end + + let(:aeeh_scope) { 'cnav_allocation_enfant_handicape' } + + def scope_displayed?(form, scope_value) + hidden = form.scopes_config[:hide] + return false if hidden.present? && hidden.include?(scope_value) + + displayed = form.scopes_config[:displayed] + displayed.blank? || displayed.include?(scope_value) + end + + it 'targets every editor form of the use case' do + expect(editor_forms).not_to be_empty + end + + it 'displays the scope on each editor form' do + editor_forms.each do |form| + expect(scope_displayed?(form, aeeh_scope)).to be_truthy, "Form: #{form.uid} does not display #{aeeh_scope}" + end + end + + it 'never pre-checks the scope' do + editor_forms.each do |form| + expect(form.initialize_with[:scopes] || []).not_to include(aeeh_scope), "Form: #{form.uid} pre-checks #{aeeh_scope}" + end + end + end end diff --git a/spec/models/authorization_request_spec.rb b/spec/models/authorization_request_spec.rb index 718f77ebf4..0d9a70a10e 100644 --- a/spec/models/authorization_request_spec.rb +++ b/spec/models/authorization_request_spec.rb @@ -368,7 +368,7 @@ context 'with displayed config on form' do let(:authorization_request) { create(:authorization_request, :api_particulier_familea) } - it { expect(available_scopes.map(&:value)).to match_array(%w[cnaf_quotient_familial cnaf_allocataires cnaf_enfants cnaf_adresse]) } + it { expect(available_scopes.map(&:value)).to match_array(%w[cnaf_quotient_familial cnaf_allocataires cnaf_enfants cnaf_adresse cnav_allocation_enfant_handicape]) } end end