Ignore:
Timestamp:
Jul 5, 2009, 11:01:59 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

fixed #62
refs #49,#39

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/tests/rm/test_common.rb

    r156 r157  
    1010include OpenEHR::RM::Data_Types::Basic
    1111include OpenEHR::RM::Data_Types::Quantity
     12include OpenEHR::RM::Data_Types::URI
    1213
    1314class RM_Common_Resource_Test < Test::Unit::TestCase
     
    4546    provider = Party_Identified.new(:name => 'NERV')
    4647    location = Party_Identified.new(:name => 'GEOFRONT')
    47     object_id = Object_ID.new('0.0.4')
     48    object_version_id = Object_Version_ID.new('ABC::DEF::1.3.4')
    4849    party_ref = Party_Ref.new('local', 'ORGANISATION', object_id)
    4950    assert_nothing_raised(Exception){
     
    180181                                         :change_type => dv_coded_text,
    181182                                         :description => dv_text)}
    182 #    change_type = OpenEHR::RM::Data_Types::Text::DV_Text.new('audit_type')
    183 #    time_committed = OpenEHR::RM::Data_Types::Quantity::Date_Time::DV_Date_Time.new(2008)
    184 #    assert_nothing_raised(Exception){@audit_details = OpenEHR::RM::Common::Generic::Audit_Details.new('rails',@party_proxy, change_type, time_committed)}
     183    dv_text = DV_Text.new('authorisation')
     184    dv_ehr_uri = DV_EHR_URI.new('ehr://test/')
     185    assert_nothing_raised(Exception){
     186      @attestation = Attestation.new(:system_id => 'NERV',
     187                                     :committer => @party_proxy,
     188                                     :time_committed => dv_date_time,
     189                                     :change_type => dv_coded_text,
     190                                     :reason => dv_text,
     191                                     :description => dv_text,
     192                                     :proof => 'hashedstring',
     193                                     :items => Set[dv_ehr_uri])}
     194    object_version_id = Object_Version_ID.new('SHOGOUKI::NERV::1.1.1')
     195    audit_details2 = Audit_Details.new(:system_id => 'MAGI',
     196                                       :committer => @party_proxy,
     197                                       :time_committed => dv_date_time2,
     198                                       :change_type => dv_coded_text)
     199    assert_nothing_raised(Exception){
     200      @revision_history_item = Revision_History_Item.new(:audits => [@audit_details, audit_details2],
     201                                                         :version_id => object_version_id)}
     202    dv_date_time3 = DV_Date_Time.new('2009-07-14T12:00:00')
     203    dv_date_time4 = DV_Date_Time.new('2009-07-15T00:00:00')
     204    audit_details3 = Audit_Details.new(:system_id => 'MAGI',
     205                                     :committer => @party_proxy,
     206                                     :time_committed => dv_date_time3,
     207                                     :change_type => dv_coded_text)
     208    audit_details4 = Audit_Details.new(:system_id => 'MAGI',
     209                                     :committer => @party_proxy,
     210                                     :time_committed => dv_date_time4,
     211                                     :change_type => dv_coded_text)
     212    object_version_id = Object_Version_ID.new('NIGOUKI::NERV::2.2.2')
     213    revision_history_item2 = Revision_History_Item.new(:audits => [audit_details3, audit_details4],
     214                                                      :version_id => object_version_id)
     215    assert_nothing_raised(Exception){
     216      @revision_history = Revision_History.new([@revision_history_item, revision_history_item2])}
    185217  end
    186218
     
    191223    assert_instance_of Participation, @participation
    192224    assert_instance_of Audit_Details, @audit_details
     225    assert_instance_of Attestation, @attestation
     226    assert_instance_of Revision_History_Item, @revision_history_item
     227    assert_instance_of Revision_History, @revision_history
    193228  end
    194229
     
    230265    assert_equal 'test environment', @audit_details.description.value
    231266  end
     267
     268  def test_attestation
     269    assert_equal 'NERV', @attestation.system_id
     270    assert_equal 'unknown', @attestation.committer.external_ref.namespace
     271    assert_equal '249', @attestation.change_type.defining_code.code_string
     272    assert_equal 7, @attestation.time_committed.month
     273    assert_equal 'authorisation', @attestation.reason.value
     274    assert_equal 'authorisation', @attestation.description.value
     275    assert_equal 'hashedstring', @attestation.proof
     276    assert_equal 'ehr://test/', @attestation.items.to_a[0].value
     277  end
     278
     279  def test_revision_history_item
     280    assert_equal 'SHOGOUKI::NERV::1.1.1', @revision_history_item.version_id.value
     281    assert_equal 'MAGI', @revision_history_item.audits[0].system_id
     282  end
     283
     284  def test_revision_history
     285    assert_equal 'NIGOUKI::NERV::2.2.2', @revision_history.most_recent_version
     286    assert_equal '2009-07-14T12:00:00', @revision_history.most_recent_version_time_committed
     287  end
    232288end
    233289
Note: See TracChangeset for help on using the changeset viewer.