Merge pull request #10905 from tchak/fix-api-entreprise-sentry-error
ETQ Usager, je veux pouvoir déposer mon dossier même si le service des SIRET n'est pas disponible
This commit is contained in:
commit
9ef445a4a1
6 changed files with 55 additions and 3 deletions
3
spec/fixtures/files/api_entreprise/error_code_01000.json
vendored
Normal file
3
spec/fixtures/files/api_entreprise/error_code_01000.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"errors": [{ "code": "01000" }]
|
||||
}
|
3
spec/fixtures/files/api_entreprise/error_code_01001.json
vendored
Normal file
3
spec/fixtures/files/api_entreprise/error_code_01001.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"errors": [{ "code": "01001" }]
|
||||
}
|
3
spec/fixtures/files/api_entreprise/error_code_01002.json
vendored
Normal file
3
spec/fixtures/files/api_entreprise/error_code_01002.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"errors": [{ "code": "01002" }]
|
||||
}
|
|
@ -24,6 +24,36 @@ describe APIEntreprise::API do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the service reponds with 01000 code' do
|
||||
let(:siren) { '111111111' }
|
||||
let(:status) { 502 }
|
||||
let(:body) { Rails.root.join('spec/fixtures/files/api_entreprise/error_code_01000.json').read }
|
||||
|
||||
it 'raises APIEntreprise::API::Error::RequestFailed' do
|
||||
expect { subject }.to raise_error(APIEntreprise::API::Error::ServiceUnavailable)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the service reponds with 01001 code' do
|
||||
let(:siren) { '111111111' }
|
||||
let(:status) { 502 }
|
||||
let(:body) { Rails.root.join('spec/fixtures/files/api_entreprise/error_code_01001.json').read }
|
||||
|
||||
it 'raises APIEntreprise::API::Error::RequestFailed' do
|
||||
expect { subject }.to raise_error(APIEntreprise::API::Error::ServiceUnavailable)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the service reponds with 01002 code' do
|
||||
let(:siren) { '111111111' }
|
||||
let(:status) { 504 }
|
||||
let(:body) { Rails.root.join('spec/fixtures/files/api_entreprise/error_code_01002.json').read }
|
||||
|
||||
it 'raises APIEntreprise::API::Error::RequestFailed' do
|
||||
expect { subject }.to raise_error(APIEntreprise::API::Error::ServiceUnavailable)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when siren does not exist' do
|
||||
let(:siren) { '111111111' }
|
||||
let(:status) { 404 }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue