Class: DaVinciPASTestKit::DaVinciPASV201::ClaimOperationTest

Inherits:
Inferno::Test
  • Object
show all
Defined in:
lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb

Instance Method Summary collapse

Instance Method Details

#perform_operation(request_payload) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb', line 34

def perform_operation(request_payload)
  start_time = Time.now
  fhir_operation('/Claim/$submit', body: request_payload, name: :pa_submit)
  response_time = Time.now - start_time

  if response_time > 15
    warning %(
        The server took more that 15 seconds to respond to the Prior Authorization
        request.

        Response Time: #{response_time}
      )
  end
  
  assert_response_status([200, 201])
  assert_valid_json(request.response_body)

  # Save request/response pair
  scratch_resources[:all] ||= []
  scratch_resources[:all] << {request_bundle: request.request_body, response_bundle: resource}
  output response_time:
end

#request_bundlesObject



29
30
31
32
# File 'lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb', line 29

def request_bundles
  parsed_payload = JSON.parse(pa_submit_request_payload)
  [parsed_payload].flatten.compact.uniq
end

#scratch_resourcesObject



25
26
27
# File 'lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb', line 25

def scratch_resources
  scratch[:submit_request_response_pair] ||= {}
end