Merge pull request #10218 from colinux/fix-api-entreprise-context

Correctif API Entreprise: transmet l'APPLICATION_NAME en `context`
This commit is contained in:
LeSim 2024-03-26 14:07:03 +00:00 committed by GitHub
commit abe0b6071e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -163,7 +163,7 @@ class APIEntreprise::API
def base_params(siret_or_siren)
{
context: Current.application_name,
context: APPLICATION_NAME,
recipient: recipient_for(siret_or_siren),
non_diffusables: true
}

View file

@ -120,7 +120,8 @@ describe APIEntreprise::API do
describe '.etablissement' do
subject { described_class.new(procedure_id).etablissement(siret) }
before do
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v3\/insee\/sirene\/etablissements\/#{siret}?.*non_diffusables=true/)
stub_request(:get, "https://entreprise.api.gouv.fr/v3/insee/sirene/etablissements/#{siret}")
.with(query: { "non_diffusables" => "true", "context" => APPLICATION_NAME, "object" => "procedure_id: #{procedure_id}", "recipient" => ENV.fetch("API_ENTREPRISE_DEFAULT_SIRET") })
.to_return(status: status, body: body)
allow_any_instance_of(APIEntrepriseToken).to receive(:expired?).and_return(false)
end