Merge pull request #1912 from betagouv/always-use-apientreprise-prod
Remove use of staging.apientreprise
This commit is contained in:
commit
234ceae6f4
10 changed files with 27 additions and 31 deletions
|
@ -1,7 +1,3 @@
|
||||||
if Rails.env.production?
|
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
||||||
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
|
||||||
else
|
|
||||||
API_ENTREPRISE_URL = 'https://staging.entreprise.api.gouv.fr/v2'
|
|
||||||
end
|
|
||||||
|
|
||||||
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
||||||
|
|
|
@ -178,19 +178,19 @@ describe Users::DossiersController, type: :controller do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
before do
|
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')
|
.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'))
|
.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'))
|
.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)
|
.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)
|
.to_return(status: rna_status, body: rna_body)
|
||||||
|
|
||||||
dossier
|
dossier
|
||||||
|
|
|
@ -30,14 +30,14 @@ feature 'user path for dossier creation' do
|
||||||
end
|
end
|
||||||
context 'sets siret' do
|
context 'sets siret' do
|
||||||
before 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))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
|
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
|
|
|
@ -67,13 +67,13 @@ feature 'As a User I wanna create a dossier' do
|
||||||
visit commencer_path(procedure_path: procedure_with_siret.path)
|
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))
|
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s))
|
||||||
fill_in 'dossier-siret', with: siret
|
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'))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
page.find_by_id('submit-siret').click
|
page.find_by_id('submit-siret').click
|
||||||
|
|
|
@ -26,13 +26,13 @@ feature 'user arrive on siret page' do
|
||||||
end
|
end
|
||||||
context 'when enter a siret', js: true do
|
context 'when enter a siret', js: true do
|
||||||
before 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'))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
|
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe ApiEntreprise::API do
|
||||||
describe '.entreprise' do
|
describe '.entreprise' do
|
||||||
subject { described_class.entreprise(siren, procedure_id) }
|
subject { described_class.entreprise(siren, procedure_id) }
|
||||||
before do
|
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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
context 'when siren does not exist' do
|
context 'when siren does not exist' do
|
||||||
|
@ -31,7 +31,7 @@ describe ApiEntreprise::API do
|
||||||
describe '.etablissement' do
|
describe '.etablissement' do
|
||||||
subject { described_class.etablissement(siret, procedure_id) }
|
subject { described_class.etablissement(siret, procedure_id) }
|
||||||
before 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: status, body: body)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ describe ApiEntreprise::API do
|
||||||
|
|
||||||
describe '.exercices' do
|
describe '.exercices' do
|
||||||
before 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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe ApiEntreprise::API do
|
||||||
|
|
||||||
describe '.rna' do
|
describe '.rna' do
|
||||||
before 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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe ApiEntreprise::EntrepriseAdapter do
|
||||||
subject { adapter.to_params }
|
subject { adapter.to_params }
|
||||||
|
|
||||||
before do
|
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))
|
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe ApiEntreprise::EtablissementAdapter do
|
||||||
subject { described_class.new(siret, procedure_id).to_params }
|
subject { described_class.new(siret, procedure_id).to_params }
|
||||||
|
|
||||||
before 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))
|
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ describe ApiEntreprise::EtablissementAdapter do
|
||||||
subject { described_class.new(bad_siret, 12).to_params }
|
subject { described_class.new(bad_siret, 12).to_params }
|
||||||
|
|
||||||
before do
|
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)
|
.to_return(body: 'Fake body', status: 404)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe ApiEntreprise::ExercicesAdapter do
|
||||||
subject { described_class.new(siret, procedure_id).to_params }
|
subject { described_class.new(siret, procedure_id).to_params }
|
||||||
|
|
||||||
before 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(body: File.read('spec/support/files/exercices.json', status: 200))
|
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe ApiEntreprise::RNAAdapter do
|
||||||
subject { adapter.to_params }
|
subject { adapter.to_params }
|
||||||
|
|
||||||
before 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(body: body, status: status)
|
.to_return(body: body, status: status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue