diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 801c2d941..7bc572d7d 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -1,5 +1,5 @@ if Rails.env.production? - SIADEURL = 'https://api.apientreprise.fr' + SIADEURL = 'https://entreprise.api.gouv.fr' else - SIADEURL = 'https://api-dev.apientreprise.fr' + SIADEURL = 'https://staging.entreprise.api.gouv.fr' end diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 1165bd7a9..1b9469517 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -178,19 +178,19 @@ describe Users::DossiersController, type: :controller do let(:user) { create(:user) } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret_not_found}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret_not_found}?token=#{SIADETOKEN}") .to_return(status: 404, body: 'fake body') - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") .to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") .to_return(status: exercices_status, body: exercices_body) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") .to_return(status: rna_status, body: rna_body) dossier diff --git a/spec/features/users/complete_demande_spec.rb b/spec/features/users/complete_demande_spec.rb index 251719434..f524fd3f9 100644 --- a/spec/features/users/complete_demande_spec.rb +++ b/spec/features/users/complete_demande_spec.rb @@ -30,14 +30,14 @@ feature 'user path for dossier creation' do end context 'sets siret' do before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(body: File.read('spec/support/files/etablissement.json', status: 200)) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") .to_return(status: 404, body: '') page.find_by_id('dossier-siret').set siret diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb index ec53ac7f7..67b1d7185 100644 --- a/spec/features/users/dossier_creation_spec.rb +++ b/spec/features/users/dossier_creation_spec.rb @@ -46,13 +46,13 @@ feature 'As a User I wanna create a dossier' do visit commencer_path(procedure_path: procedure_with_siret.path) expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) fill_in 'dossier-siret', with: siret - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") .to_return(status: 404, body: '') page.find_by_id('dossier-siret').set siret page.find_by_id('submit-siret').trigger('click') diff --git a/spec/features/users/start_demande_spec.rb b/spec/features/users/start_demande_spec.rb index 5e8be6375..caa29fc31 100644 --- a/spec/features/users/start_demande_spec.rb +++ b/spec/features/users/start_demande_spec.rb @@ -26,13 +26,13 @@ feature 'user arrive on siret page' do end context 'when enter a siret', js: true do before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}") .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, "https://api-dev.apientreprise.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") .to_return(status: 404, body: '') page.find_by_id('dossier-siret').set siret diff --git a/spec/lib/siade/api_spec.rb b/spec/lib/siade/api_spec.rb index 617e3db48..591e10423 100644 --- a/spec/lib/siade/api_spec.rb +++ b/spec/lib/siade/api_spec.rb @@ -4,7 +4,7 @@ describe SIADE::API do describe '.entreprise' do subject { described_class.entreprise(siren) } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}") .to_return(status: status, body: body) end context 'when siren does not exist' do @@ -30,7 +30,7 @@ describe SIADE::API do describe '.etablissement' do subject { described_class.etablissement(siret) } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(status: status, body: body) end @@ -57,7 +57,7 @@ describe SIADE::API do describe '.exercices' do before do - stub_request(:get, /https:\/\/api-dev.apientreprise.fr\/v2\/exercices\/.*token=/) + stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) .to_return(status: status, body: body) end @@ -88,7 +88,7 @@ describe SIADE::API do describe '.rna' do before do - stub_request(:get, /https:\/\/api-dev.apientreprise.fr\/v2\/associations\/.*token=/) + stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/) .to_return(status: status, body: body) end diff --git a/spec/lib/siade/entreprise_adapter_spec.rb b/spec/lib/siade/entreprise_adapter_spec.rb index 3cfd96673..02a2e7f42 100644 --- a/spec/lib/siade/entreprise_adapter_spec.rb +++ b/spec/lib/siade/entreprise_adapter_spec.rb @@ -4,7 +4,7 @@ describe SIADE::EntrepriseAdapter do subject { described_class.new('418166096').to_params } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/418166096?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/418166096?token=#{SIADETOKEN}") .to_return(body: File.read('spec/support/files/entreprise.json', status: 200)) end diff --git a/spec/lib/siade/etablissement_adapter_spec.rb b/spec/lib/siade/etablissement_adapter_spec.rb index 6d6257773..1693a2756 100644 --- a/spec/lib/siade/etablissement_adapter_spec.rb +++ b/spec/lib/siade/etablissement_adapter_spec.rb @@ -6,7 +6,7 @@ describe SIADE::EtablissementAdapter do subject { described_class.new(siret).to_params } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") .to_return(body: File.read('spec/support/files/etablissement.json', status: 200)) end @@ -73,7 +73,7 @@ describe SIADE::EtablissementAdapter do subject { described_class.new(bad_siret).to_params } before do - stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{bad_siret}?token=#{SIADETOKEN}") + stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{bad_siret}?token=#{SIADETOKEN}") .to_return(body: 'Fake body', status: 404) end diff --git a/spec/lib/siade/exercices_adapter_spec.rb b/spec/lib/siade/exercices_adapter_spec.rb index 74f12a78a..bdf499021 100644 --- a/spec/lib/siade/exercices_adapter_spec.rb +++ b/spec/lib/siade/exercices_adapter_spec.rb @@ -5,7 +5,7 @@ describe SIADE::ExercicesAdapter do subject { described_class.new(siret).to_params } before do - stub_request(:get, /https:\/\/api-dev.apientreprise.fr\/v2\/exercices\/.*token=/) + stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) .to_return(body: File.read('spec/support/files/exercices.json', status: 200)) end diff --git a/spec/lib/siade/rna_adapter_spec.rb b/spec/lib/siade/rna_adapter_spec.rb index 5522ef9c2..ded722203 100644 --- a/spec/lib/siade/rna_adapter_spec.rb +++ b/spec/lib/siade/rna_adapter_spec.rb @@ -8,7 +8,7 @@ describe SIADE::RNAAdapter do subject { described_class.new(siret).to_params } before do - stub_request(:get, /https:\/\/api-dev.apientreprise.fr\/v2\/associations\/.*token=/) + stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/) .to_return(body: body, status: status) end