Change HTTP status codes for Poseidon in accordance with recent changes.
See https://github.com/openHPI/poseidon/pull/159
This commit is contained in:

committed by
Sebastian Serth

parent
5f0229029c
commit
ba821bd18b
@ -209,7 +209,7 @@ class Runner::Strategy::Poseidon < Runner::Strategy
|
||||
raise Runner::Error::BadRequest.new(response_body[:message])
|
||||
when 401
|
||||
raise Runner::Error::Unauthorized.new('Authentication with Poseidon failed')
|
||||
when 404
|
||||
when 410
|
||||
raise Runner::Error::RunnerNotFound.new
|
||||
when 500
|
||||
response_body = parse response
|
||||
|
@ -57,10 +57,10 @@ describe Runner::Strategy::Poseidon do
|
||||
end
|
||||
end
|
||||
|
||||
# All requests except creation handle a NotFound (404) response the same way.
|
||||
shared_examples 'NotFound (404) error handling' do
|
||||
context 'when Poseidon returns NotFound (404)' do
|
||||
let(:response_status) { 404 }
|
||||
# All runner requests except creation handle a Gone (410) response the same way.
|
||||
shared_examples 'Gone (410) error handling' do
|
||||
context 'when Poseidon returns NotFound (410)' do
|
||||
let(:response_status) { 410 }
|
||||
|
||||
it 'raises an error' do
|
||||
expect { action.call }.to raise_error(Runner::Error::RunnerNotFound)
|
||||
@ -293,7 +293,7 @@ describe Runner::Strategy::Poseidon do
|
||||
include_examples 'BadRequest (400) error handling'
|
||||
include_examples 'BadRequest (400) destroys local runner'
|
||||
include_examples 'Unauthorized (401) error handling'
|
||||
include_examples 'NotFound (404) error handling'
|
||||
include_examples 'Gone (410) error handling'
|
||||
include_examples 'InternalServerError (500) error handling'
|
||||
include_examples 'unknown response status error handling'
|
||||
include_examples 'Faraday error handling'
|
||||
@ -316,8 +316,8 @@ describe Runner::Strategy::Poseidon do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when Poseidon returns NotFound (404)' do
|
||||
let(:response_status) { 404 }
|
||||
context 'when Poseidon returns Gone (410)' do
|
||||
let(:response_status) { 410 }
|
||||
|
||||
it 'raises an error' do
|
||||
expect { action.call }.not_to raise_error
|
||||
@ -357,7 +357,7 @@ describe Runner::Strategy::Poseidon do
|
||||
include_examples 'BadRequest (400) error handling'
|
||||
include_examples 'BadRequest (400) destroys local runner'
|
||||
include_examples 'Unauthorized (401) error handling'
|
||||
include_examples 'NotFound (404) error handling'
|
||||
include_examples 'Gone (410) error handling'
|
||||
include_examples 'InternalServerError (500) error handling'
|
||||
include_examples 'unknown response status error handling'
|
||||
include_examples 'Faraday error handling'
|
||||
|
Reference in New Issue
Block a user