Merge pull request #1073 from sgmap/fix_1046_update_apientreprise_host

[fix 1046] Update api entreprise host
This commit is contained in:
LeSim 2017-12-11 16:08:58 +01:00 committed by GitHub
commit d5001aa89e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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')

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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