Module: DaVinciPDexTestKit::PDexPayerClient::MockServer

Includes:
URLs
Included in:
DaVinciPDexTestKit::PDexPayerClientSuite
Defined in:
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/proxy_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/binary_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/next_page_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/member_match_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_read_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_search_endpoint.rb,
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_everything_endpoint.rb

Overview

FHIR Server for Client TestSuite Requires URLs and Inferno::DSL::Runnable modules to be included in Client TestSuite

Defined Under Namespace

Classes: BinaryEndpoint, ExportEndpoint, ExportStatusEndpoint, MemberMatchEndpoint, NextPageEndpoint, PatientEndpoint, PatientEverythingEndpoint, ProxyEndpoint, ResourceReadEndpoint, ResourceSearchEndpoint

Constant Summary

Constants included from URLs

URLs::AUTHORIZATION_PATH, URLs::BASE_FHIR_PATH, URLs::BINARY_PATH, URLs::EVERYTHING_PATH, URLs::EXPORT_PATH, URLs::EXPORT_STATUS_PATH, URLs::INSTANCE_PATH, URLs::MEMBER_MATCH_PATH, URLs::METADATA_PATH, URLs::PATIENT_INSTANCE_PATH, URLs::PATIENT_PATH, URLs::RESOURCE_PATH, URLs::RESUME_CLINICAL_DATA_PATH, URLs::RESUME_FAIL_PATH, URLs::RESUME_PASS_PATH, URLs::TOKEN_PATH

Class Method Summary collapse

Methods included from URLs

#base_url, #client_fhir_base_url, #fhir_base_url, #suite_id

Class Method Details

.included(klass) ⇒ Object

The ‘suite_endpoint` function is only available in a Runnable, so we define a hook where when this module is included into a class it’s executed in the class’ namespace.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server.rb', line 30

def self.included(klass)
  klass.class_eval do

    # Add your routes/endpoints here, order matters!
    route :get, METADATA_PATH, Proc.new {
      [
        200,
        {'Content-Type' => 'application/fhir+json;charset=utf8'},
        File.readlines(File.expand_path('mock_server/resources/mock_capability_statement.json', __dir__))
      ]
    }

    # SMART App Launch / Backend Services server simulation
    route(:get, SMARTAppLaunch::SMART_DISCOVERY_PATH, lambda { |_env|
      SMARTAppLaunch::MockSMARTServer.(id)
    })
    route(:get, UDAPSecurityTestKit::UDAP_DISCOVERY_PATH, lambda { |_env|
      UDAPSecurityTestKit::MockUDAPServer.(id)
    })
    route(:get, SMARTAppLaunch::OIDC_DISCOVERY_PATH, ->(_env) {SMARTAppLaunch::MockSMARTServer.(id) }) 
    route(
      :get,
      SMARTAppLaunch::OIDC_JWKS_PATH,
      ->(_env) { [200, { 'Content-Type' => 'application/json' }, [SMARTAppLaunch::OIDCJWKS.jwks_json]] }
    )
    suite_endpoint :post, UDAPSecurityTestKit::REGISTRATION_PATH,
                            UDAPSecurityTestKit::MockUDAPServer::RegistrationEndpoint
    suite_endpoint :post, UDAPSecurityTestKit::TOKEN_PATH, 
                          DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::TokenEndpoint
    suite_endpoint :get,  UDAPSecurityTestKit::AUTHORIZATION_PATH,
                          DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::AuthorizationEndpoint
    suite_endpoint :post, UDAPSecurityTestKit::AUTHORIZATION_PATH,
                          DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::AuthorizationEndpoint

    suite_endpoint :post, MEMBER_MATCH_PATH, MemberMatchEndpoint
    suite_endpoint :get, EVERYTHING_PATH, PatientEverythingEndpoint
    suite_endpoint :get, EXPORT_PATH, ExportEndpoint
    suite_endpoint :get, EXPORT_STATUS_PATH, ExportStatusEndpoint
    suite_endpoint :get, BINARY_PATH, BinaryEndpoint
    suite_endpoint :get, PATIENT_PATH, PatientEndpoint # PDex Patient query needs its own endpoint
    suite_endpoint :get, RESOURCE_PATH, ResourceSearchEndpoint
    suite_endpoint :get, INSTANCE_PATH, ResourceReadEndpoint
    suite_endpoint :get, PATIENT_INSTANCE_PATH, ResourceReadEndpoint
    suite_endpoint :get, BASE_FHIR_PATH, NextPageEndpoint # TODO: better pagination route?

  end
end