Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class AuthenticationTokenResponse

def initialize(http_response)
@http_response = http_response
handle_soap_error
handle_http_error
handle_soap_error
parse_response
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class SecurityTokenResponse

def initialize(http_response)
@http_response = http_response
handle_soap_error
handle_http_error
handle_soap_error
parse_response
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def initialize(http_response)
@missing_attributes = []
@verification_results = {}
@http_response = http_response
handle_soap_error
handle_http_error
handle_soap_error
parse_response
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
end
end

context 'with a non-200 status code and a non-xml body' do
let(:status_code) { 504 }
let(:response_body) { '<h1>Oh no</h1><hr><p>This is not xml.' }

it 'raises a AuthenticationError' do
expect { subject }.to raise_error(
Proofing::Aamva::AuthenticationError,
'Unexpected status code in response: 504',
)
end
end

context 'when the API response has an error' do
let(:response_body) { AamvaFixtures.soap_fault_response_simplified }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
end
end

context 'with a non-200 status code and a non-xml body' do
let(:status_code) { 504 }
let(:response_body) { '<h1>Oh no</h1><hr><p>This is not xml.' }

it 'raises a AuthenticationError' do
expect { subject }.to raise_error(
Proofing::Aamva::AuthenticationError,
'Unexpected status code in response: 504',
)
end
end

context 'when the API response is an error' do
let(:response_body) { AamvaFixtures.soap_fault_response_simplified }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
end
end

context 'with a non-200 status code and a non-xml body' do
let(:status_code) { 504 }
let(:response_body) { '<h1>Oh no</h1><hr><p>This is not xml.' }

it 'raises a VerificationError' do
expect { subject }.to raise_error(
Proofing::Aamva::VerificationError,
'Unexpected status code in response: 504',
)
end
end

context 'when the API response has an error' do
let(:response_body) { AamvaFixtures.soap_fault_response_simplified }

Expand Down