Skip to content

Commit

Permalink
updated spec
Browse files Browse the repository at this point in the history
Signed-off-by: Vanessa Fotso <[email protected]>
  • Loading branch information
vanessuniq committed Aug 26, 2024
1 parent 78a0a07 commit 63ec527
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/inferno/dsl/fhir_resource_validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@
validator.resource_is_valid?(resource2, profile_url, runnable)
end.to raise_error(Inferno::Exceptions::ErrorInValidatorException)
end

it 'removes non-printable characters from the response' do
stub_request(:post, "#{validation_url}/validate")
.with(body: wrapped_resource_string)
.to_return(
status: 500,
body: "<html><body>Internal Server Error: content#{0.chr} with non-printable#{1.chr} characters</body></html>"
)

expect do
validator.resource_is_valid?(resource2, profile_url, runnable)
end.to raise_error(Inferno::Exceptions::ErrorInValidatorException)

msg = runnable.messages.first[:message]
expect(msg).not_to include(0.chr)
expect(msg).not_to include(1.chr)
expect(msg).to match(/Internal Server Error: content with non-printable/)
end
end

describe '.cli_context' do
Expand Down
18 changes: 18 additions & 0 deletions spec/inferno/dsl/fhir_validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,24 @@

expect(validator.resource_is_valid?(resource, profile_url, runnable)).to be(true)
end

it 'removes non-printable characters from the response' do
stub_request(:post, "#{validation_url}/validate?profile=#{profile_url}")
.with(body: resource_string)
.to_return(
status: 500,
body: "<html><body>Internal Server Error: content#{0.chr} with non-printable#{1.chr} characters</body></html>"
)

expect do
validator.resource_is_valid?(resource, profile_url, runnable)
end.to raise_error(Inferno::Exceptions::ErrorInValidatorException)

msg = runnable.messages.first[:message]
expect(msg).not_to include(0.chr)
expect(msg).not_to include(1.chr)
expect(msg).to match(/Internal Server Error: content with non-printable/)
end
end

describe '.find_validator' do
Expand Down

0 comments on commit 63ec527

Please sign in to comment.