Skip to content

Commit

Permalink
Fix SuiteEndpoint docs (#571)
Browse files Browse the repository at this point in the history
* fix yard docs

* cop
  • Loading branch information
Shaumik-Ashraf authored Dec 10, 2024
1 parent 40b6c5c commit bcb8fb6
Showing 1 changed file with 58 additions and 58 deletions.
116 changes: 58 additions & 58 deletions lib/inferno/dsl/suite_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,54 @@ module DSL
# endpoint](https://github.com/hanami/controller/tree/v2.0.0).
#
# @example
# class AuthorizedEndpoint < Inferno::DSL::SuiteEndpoint
# # Identify the incoming request based on a bearer token
# def test_run_identifier
# request.header['authorization']&.delete_prefix('Bearer ')
# end
# class AuthorizedEndpoint < Inferno::DSL::SuiteEndpoint
# # Identify the incoming request based on a bearer token
# def test_run_identifier
# request.header['authorization']&.delete_prefix('Bearer ')
# end
#
# # Return a json FHIR Patient resource
# def make_response
# response.status = 200
# response.body = FHIR::Patient.new(id: 'abcdef').to_json
# response.format = :json
# end
# # Return a json FHIR Patient resource
# def make_response
# response.status = 200
# response.body = FHIR::Patient.new(id: 'abcdef').to_json
# response.format = :json
# end
#
# # Update the waiting test to pass when the incoming request is received.
# # This will resume the test run.
# def update_result
# results_repo.update(result.id, result: 'pass')
# end
# # Update the waiting test to pass when the incoming request is received.
# # This will resume the test run.
# def update_result
# results_repo.update(result.id, result: 'pass')
# end
#
# # Apply the 'authorized' tag to the incoming request so that it may be
# # used by later tests.
# def tags
# ['authorized']
# end
# end
# # Apply the 'authorized' tag to the incoming request so that it may be
# # used by later tests.
# def tags
# ['authorized']
# end
# end
#
# class AuthorizedRequestSuite < Inferno::TestSuite
# id :authorized_suite
# suite_endpoint :get, '/authorized_endpoint', AuthorizedEndpoint
# class AuthorizedRequestSuite < Inferno::TestSuite
# id :authorized_suite
# suite_endpoint :get, '/authorized_endpoint', AuthorizedEndpoint
#
# group do
# title 'Authorized Request Group'
# group do
# title 'Authorized Request Group'
#
# test do
# title 'Wait for authorized request'
# test do
# title 'Wait for authorized request'
#
# input :bearer_token
# input :bearer_token
#
# run do
# wait(
# identifier: bearer_token,
# message: "Waiting to receive a request with bearer_token: #{bearer_token}" \
# "at `#{Inferno::Application['base_url']}/custom/authorized_suite/authorized_endpoint`"
# )
# run do
# wait(
# identifier: bearer_token,
# message: "Waiting to receive a request with bearer_token: #{bearer_token}" \
# "at `#{Inferno::Application['base_url']}/custom/authorized_suite/authorized_endpoint`"
# )
# end
# end
# end
# end
# end
# end
class SuiteEndpoint < Hanami::Action
attr_reader :req, :res

Expand All @@ -69,11 +69,11 @@ class SuiteEndpoint < Hanami::Action
# @return [String]
#
# @example
# def test_run_identifier
# # Identify the test session of an incoming request based on the bearer
# # token
# request.headers['authorization']&.delete_prefix('Bearer ')
# end
# def test_run_identifier
# # Identify the test session of an incoming request based on the bearer
# # token
# request.headers['authorization']&.delete_prefix('Bearer ')
# end
def test_run_identifier
nil
end
Expand All @@ -83,11 +83,11 @@ def test_run_identifier
# @return [Void]
#
# @example
# def make_response
# response.status = 200
# response.body = { abc: 123 }.to_json
# response.format = :json
# end
# def make_response
# response.status = 200
# response.body = { abc: 123 }.to_json
# response.format = :json
# end
def make_response
nil
end
Expand All @@ -113,9 +113,9 @@ def name
# @return [Void]
#
# @example
# def update_result
# results_repo.update(result.id, result: 'pass')
# end
# def update_result
# results_repo.update(result.id, result: 'pass')
# end
def update_result
nil
end
Expand Down Expand Up @@ -165,9 +165,9 @@ def initialize(config: self.class.config) # rubocop:disable Lint/MissingSuper
# @return [Hanami::Action::Request]
#
# @example
# request.params # Get url/query params
# request.body.read # Get body
# request.headers['accept'] # Get Accept header
# request.params # Get url/query params
# request.body.read # Get body
# request.headers['accept'] # Get Accept header
def request
req
end
Expand All @@ -178,10 +178,10 @@ def request
# @return [Hanami::Action::Response]
#
# @example
# response.status = 200 # Set the status
# response.body = 'Ok' # Set the body
# # Set headers
# response.headers.merge!('X-Custom-Header' => 'CUSTOM_HEADER_VALUE')
# response.status = 200 # Set the status
# response.body = 'Ok' # Set the body
# # Set headers
# response.headers.merge!('X-Custom-Header' => 'CUSTOM_HEADER_VALUE')
def response
res
end
Expand Down

0 comments on commit bcb8fb6

Please sign in to comment.