From 3e176d4e08b302b3aa1e5e6c8eb9480fb5d79521 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Wed, 9 May 2018 12:03:04 +0200 Subject: [PATCH] Remove use of staging.apientreprise --- config/initializers/urls.rb | 6 +----- spec/controllers/users/dossiers_controller_spec.rb | 10 +++++----- spec/features/users/complete_demande_spec.rb | 8 ++++---- spec/features/users/dossier_creation_spec.rb | 8 ++++---- spec/features/users/start_demande_spec.rb | 8 ++++---- spec/lib/api_entreprise/api_spec.rb | 8 ++++---- spec/lib/api_entreprise/entreprise_adapter_spec.rb | 2 +- spec/lib/api_entreprise/etablissement_adapter_spec.rb | 4 ++-- spec/lib/api_entreprise/exercices_adapter_spec.rb | 2 +- spec/lib/api_entreprise/rna_adapter_spec.rb | 2 +- 10 files changed, 27 insertions(+), 31 deletions(-) diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 510cd60ea..7d9eb1124 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -1,7 +1,3 @@ -if Rails.env.production? - API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2' -else - API_ENTREPRISE_URL = 'https://staging.entreprise.api.gouv.fr/v2' -end +API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2' PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1' diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 53a550401..8eff31ad1 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:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret_not_found}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret_not_found}?.*token=/) .to_return(status: 404, body: 'fake body') - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) .to_return(status: exercices_status, body: exercices_body) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .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 5d8391174..25d639ae8 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:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(body: File.read('spec/support/files/etablissement.json', status: 200)) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .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 84572b3d5..6b15bf0a1 100644 --- a/spec/features/users/dossier_creation_spec.rb +++ b/spec/features/users/dossier_creation_spec.rb @@ -67,13 +67,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)) fill_in 'dossier-siret', with: siret - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .to_return(status: 404, body: '') page.find_by_id('dossier-siret').set siret page.find_by_id('submit-siret').click diff --git a/spec/features/users/start_demande_spec.rb b/spec/features/users/start_demande_spec.rb index e1f141928..40aac6547 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:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/etablissement.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/entreprise.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) .to_return(status: 200, body: File.read('spec/support/files/exercices.json')) - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .to_return(status: 404, body: '') page.find_by_id('dossier-siret').set siret diff --git a/spec/lib/api_entreprise/api_spec.rb b/spec/lib/api_entreprise/api_spec.rb index ded04e7d5..070568dba 100644 --- a/spec/lib/api_entreprise/api_spec.rb +++ b/spec/lib/api_entreprise/api_spec.rb @@ -5,7 +5,7 @@ describe ApiEntreprise::API do describe '.entreprise' do subject { described_class.entreprise(siren, procedure_id) } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(status: status, body: body) end context 'when siren does not exist' do @@ -31,7 +31,7 @@ describe ApiEntreprise::API do describe '.etablissement' do subject { described_class.etablissement(siret, procedure_id) } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(status: status, body: body) end @@ -58,7 +58,7 @@ describe ApiEntreprise::API do describe '.exercices' do before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) .to_return(status: status, body: body) end @@ -89,7 +89,7 @@ describe ApiEntreprise::API do describe '.rna' do before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/.*token=/) .to_return(status: status, body: body) end diff --git a/spec/lib/api_entreprise/entreprise_adapter_spec.rb b/spec/lib/api_entreprise/entreprise_adapter_spec.rb index af559f3ac..f9eaf62eb 100644 --- a/spec/lib/api_entreprise/entreprise_adapter_spec.rb +++ b/spec/lib/api_entreprise/entreprise_adapter_spec.rb @@ -7,7 +7,7 @@ describe ApiEntreprise::EntrepriseAdapter do subject { adapter.to_params } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) .to_return(body: File.read('spec/support/files/entreprise.json', status: 200)) end diff --git a/spec/lib/api_entreprise/etablissement_adapter_spec.rb b/spec/lib/api_entreprise/etablissement_adapter_spec.rb index e9a3a5c02..31f21414a 100644 --- a/spec/lib/api_entreprise/etablissement_adapter_spec.rb +++ b/spec/lib/api_entreprise/etablissement_adapter_spec.rb @@ -8,7 +8,7 @@ describe ApiEntreprise::EtablissementAdapter do subject { described_class.new(siret, procedure_id).to_params } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) .to_return(body: File.read('spec/support/files/etablissement.json', status: 200)) end @@ -75,7 +75,7 @@ describe ApiEntreprise::EtablissementAdapter do subject { described_class.new(bad_siret, 12).to_params } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{bad_siret}?.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{bad_siret}?.*token=/) .to_return(body: 'Fake body', status: 404) end diff --git a/spec/lib/api_entreprise/exercices_adapter_spec.rb b/spec/lib/api_entreprise/exercices_adapter_spec.rb index 4feec27da..bdfe2c7da 100644 --- a/spec/lib/api_entreprise/exercices_adapter_spec.rb +++ b/spec/lib/api_entreprise/exercices_adapter_spec.rb @@ -6,7 +6,7 @@ describe ApiEntreprise::ExercicesAdapter do subject { described_class.new(siret, procedure_id).to_params } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) + stub_request(:get, /https:\/\/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/api_entreprise/rna_adapter_spec.rb b/spec/lib/api_entreprise/rna_adapter_spec.rb index 7edbcb2aa..2df856cbe 100644 --- a/spec/lib/api_entreprise/rna_adapter_spec.rb +++ b/spec/lib/api_entreprise/rna_adapter_spec.rb @@ -10,7 +10,7 @@ describe ApiEntreprise::RNAAdapter do subject { adapter.to_params } before do - stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/) + stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/.*token=/) .to_return(body: body, status: status) end