Class: Crucible::Tests::ResourceTest
- Defined in:
- lib/tests/suites/resource_test.rb
Constant Summary
Constants inherited from BaseSuite
Constants inherited from BaseTest
BaseTest::BASE_SPEC_LINK, BaseTest::JSON_FIELDS, BaseTest::METADATA_FIELDS, BaseTest::REST_SPEC_LINK, BaseTest::STATUS
Instance Attribute Summary collapse
-
#bundle ⇒ Object
Returns the value of attribute bundle.
-
#conditional_create_resource_a ⇒ Object
Returns the value of attribute conditional_create_resource_a.
-
#conditional_create_resource_b ⇒ Object
Returns the value of attribute conditional_create_resource_b.
-
#conditional_create_resource_c ⇒ Object
Returns the value of attribute conditional_create_resource_c.
-
#conditional_update_resource_a ⇒ Object
Returns the value of attribute conditional_update_resource_a.
-
#conditional_update_resource_c ⇒ Object
Returns the value of attribute conditional_update_resource_c.
-
#history_bundle ⇒ Object
Returns the value of attribute history_bundle.
-
#preexisting ⇒ Object
Returns the value of attribute preexisting.
-
#preexisting_id ⇒ Object
Returns the value of attribute preexisting_id.
-
#preexisting_version ⇒ Object
Returns the value of attribute preexisting_version.
-
#resource_class ⇒ Object
Returns the value of attribute resource_class.
-
#temp_resource ⇒ Object
Returns the value of attribute temp_resource.
-
#temp_version ⇒ Object
Returns the value of attribute temp_version.
Attributes inherited from BaseTest
#tags, #tests_subset, #warnings
Instance Method Summary collapse
- #category ⇒ Object
- #define_metadata(method) ⇒ Object
- #description ⇒ Object
- #execute(resource_class = nil) ⇒ Object
- #id ⇒ Object
-
#initialize(client1, client2 = nil) ⇒ ResourceTest
constructor
A new instance of ResourceTest.
-
#result_id_suffix ⇒ Object
this allows results to have unique ids for resource based tests.
- #supplement_test_description(desc) ⇒ Object
- #teardown ⇒ Object
Methods inherited from BaseSuite
#build_messages, #collect_metadata, fhir_resources, #links, #metadata, #parse_operation_outcome, #requires, #resource_category, test, #title, #validates
Methods inherited from BaseTest
#author, #details, #execute_test_method, #execute_test_methods, #ignore_client_exception, #multiserver, #requires_authorization, #tests, #warning
Methods included from Assertions
#assert, #assert_bundle_entry_count, #assert_bundle_response, #assert_bundle_transactions_okay, #assert_equal, #assert_etag_present, #assert_last_modified_present, #assert_minimum, #assert_navigation_links, #assert_operator, #assert_resource_content_type, #assert_resource_type, #assert_response_bad, #assert_response_code, #assert_response_conflict, #assert_response_created, #assert_response_gone, #assert_response_not_found, #assert_response_ok, #assert_valid_content_location_present, #assert_valid_profile, #assert_valid_resource_content_type_present, #assertion_negated, #skip
Constructor Details
#initialize(client1, client2 = nil) ⇒ ResourceTest
Returns a new instance of ResourceTest.
51 52 53 |
# File 'lib/tests/suites/resource_test.rb', line 51 def initialize(client1, client2=nil) super(client1, client2) end |
Instance Attribute Details
#bundle ⇒ Object
Returns the value of attribute bundle.
6 7 8 |
# File 'lib/tests/suites/resource_test.rb', line 6 def bundle @bundle end |
#conditional_create_resource_a ⇒ Object
Returns the value of attribute conditional_create_resource_a.
12 13 14 |
# File 'lib/tests/suites/resource_test.rb', line 12 def conditional_create_resource_a @conditional_create_resource_a end |
#conditional_create_resource_b ⇒ Object
Returns the value of attribute conditional_create_resource_b.
13 14 15 |
# File 'lib/tests/suites/resource_test.rb', line 13 def conditional_create_resource_b @conditional_create_resource_b end |
#conditional_create_resource_c ⇒ Object
Returns the value of attribute conditional_create_resource_c.
14 15 16 |
# File 'lib/tests/suites/resource_test.rb', line 14 def conditional_create_resource_c @conditional_create_resource_c end |
#conditional_update_resource_a ⇒ Object
Returns the value of attribute conditional_update_resource_a.
15 16 17 |
# File 'lib/tests/suites/resource_test.rb', line 15 def conditional_update_resource_a @conditional_update_resource_a end |
#conditional_update_resource_c ⇒ Object
Returns the value of attribute conditional_update_resource_c.
16 17 18 |
# File 'lib/tests/suites/resource_test.rb', line 16 def conditional_update_resource_c @conditional_update_resource_c end |
#history_bundle ⇒ Object
Returns the value of attribute history_bundle.
7 8 9 |
# File 'lib/tests/suites/resource_test.rb', line 7 def history_bundle @history_bundle end |
#preexisting ⇒ Object
Returns the value of attribute preexisting.
20 21 22 |
# File 'lib/tests/suites/resource_test.rb', line 20 def preexisting @preexisting end |
#preexisting_id ⇒ Object
Returns the value of attribute preexisting_id.
18 19 20 |
# File 'lib/tests/suites/resource_test.rb', line 18 def preexisting_id @preexisting_id end |
#preexisting_version ⇒ Object
Returns the value of attribute preexisting_version.
19 20 21 |
# File 'lib/tests/suites/resource_test.rb', line 19 def preexisting_version @preexisting_version end |
#resource_class ⇒ Object
Returns the value of attribute resource_class.
5 6 7 |
# File 'lib/tests/suites/resource_test.rb', line 5 def resource_class @resource_class end |
#temp_resource ⇒ Object
Returns the value of attribute temp_resource.
9 10 11 |
# File 'lib/tests/suites/resource_test.rb', line 9 def temp_resource @temp_resource end |
#temp_version ⇒ Object
Returns the value of attribute temp_version.
10 11 12 |
# File 'lib/tests/suites/resource_test.rb', line 10 def temp_version @temp_version end |
Instance Method Details
#category ⇒ Object
46 47 48 49 |
# File 'lib/tests/suites/resource_test.rb', line 46 def category resource = @resource_class.nil? ? "Uncategorized" : resource_category(@resource_class.name.demodulize) {id: "resources_#{resource.parameterize}", title: "#{resource} Resources"} end |
#define_metadata(method) ⇒ Object
743 744 745 746 747 |
# File 'lib/tests/suites/resource_test.rb', line 743 def (method) links "#{REST_SPEC_LINK}##{method}" links "#{BASE_SPEC_LINK}/#{resource_class.name.demodulize.downcase}.html" validates resource: resource_class.name.demodulize, methods: [method] end |
#description ⇒ Object
42 43 44 |
# File 'lib/tests/suites/resource_test.rb', line 42 def description "Basic operations for FHIR #{resource_class.name.demodulize} resource (CREATE, READ, VREAD, UPDATE, DELETE, HISTORY, SEARCH, VALIDATE)" end |
#execute(resource_class = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tests/suites/resource_test.rb', line 22 def execute(resource_class=nil) if resource_class @resource_class = resource_class {"ResourceTest_#{@resource_class.name.demodulize}" => execute_test_methods} else results = {} Crucible::Tests::BaseSuite.fhir_resources.each do | klass | @resource_class = klass results.merge!({"ResourceTest_#{@resource_class.name.demodulize}" => execute_test_methods}) end results end end |
#id ⇒ Object
36 37 38 39 40 |
# File 'lib/tests/suites/resource_test.rb', line 36 def id suffix = resource_class suffix = resource_class.name.demodulize if !resource_class.nil? "ResourceTest_#{suffix}" end |
#result_id_suffix ⇒ Object
this allows results to have unique ids for resource based tests
56 57 58 |
# File 'lib/tests/suites/resource_test.rb', line 56 def result_id_suffix resource_class.name.demodulize end |
#supplement_test_description(desc) ⇒ Object
60 61 62 |
# File 'lib/tests/suites/resource_test.rb', line 60 def supplement_test_description(desc) "#{resource_class.name.demodulize}: #{desc}" end |
#teardown ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/tests/suites/resource_test.rb', line 64 def teardown ignore_client_exception { @temp_resource.destroy if @temp_resource } ignore_client_exception { @conditional_create_resource_a.destroy if @conditional_create_resource_a } ignore_client_exception { @conditional_create_resource_b.destroy if @conditional_create_resource_b } ignore_client_exception { @conditional_create_resource_c.destroy if @conditional_create_resource_c } ignore_client_exception { @conditional_create_resource_d.destroy if @conditional_create_resource_d } end |