diff --git a/app/lib/api_entreprise/api.rb b/app/lib/api_entreprise/api.rb index afb5e0f25..db53afc5a 100644 --- a/app/lib/api_entreprise/api.rb +++ b/app/lib/api_entreprise/api.rb @@ -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 } diff --git a/spec/lib/api_entreprise/api_spec.rb b/spec/lib/api_entreprise/api_spec.rb index e273402e7..12110930f 100644 --- a/spec/lib/api_entreprise/api_spec.rb +++ b/spec/lib/api_entreprise/api_spec.rb @@ -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