Class: SMART_UDAP_HarmonizationTestKit::SMART_UDAP_EncounterContextTest
Overview
rubocop:disable Naming/ClassAndModuleCamelCase
Constant Summary
collapse
- FHIR_ID_REGEX =
/[A-Za-z0-9\-\.]{1,64}/
Instance Attribute Summary
#token_response
Instance Method Summary
collapse
#context_field, #context_field_present?, #missing_received_context_scopes, #missing_received_scopes_string, #missing_requested_context_scopes, #missing_requested_scopes_string, #received_scopes, #received_scopes_list, #requested_scopes, #requested_scopes_list
Instance Method Details
#context_field_name ⇒ Object
26
27
28
|
# File 'lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb', line 26
def context_field_name
'encounter'
end
|
#context_scopes ⇒ Object
30
31
32
|
# File 'lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb', line 30
def context_scopes
['launch', 'launch/encounter'].freeze
end
|
#missing_received_context_scopes? ⇒ Boolean
38
39
40
41
42
43
|
# File 'lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb', line 38
def missing_received_context_scopes?
received_scopes_list.exclude? 'launch/encounter'
end
|
#missing_requested_context_scopes? ⇒ Boolean
34
35
36
|
# File 'lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb', line 34
def missing_requested_context_scopes?
context_scopes.none? { |scope| requested_scopes_list.include? scope }
end
|
#validate_context_field ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb', line 45
def validate_context_field
assert context_field.is_a?(String),
"Expected `#{context_field_name}` to be a String, but found: `#{context_field.class.name}`"
warn do
assert context_field.match?(FHIR_ID_REGEX), "`#{context_field}` is not a valid FHIR resource id."
end
fhir_read(:encounter, context_field)
assert_response_status(200)
assert_resource_type(:encounter)
end
|