<< | Index | >>
Confirm the current test passing
test/test_plugin/bsv_xml.rb
def test_update_preparation__update_only_SB_flag # prepare the same entry with load data, @src package = setup_package :pharmacode => "987654", :steps => %w{39271 02 028}, :price_public => Util::Money.new(2.9), :price_exfactory => Util::Money.new(7.5) # :generic_type => :original, # :index_therapeuticus => '07.10.10.' package.should_receive(:deductible).and_return(:deductible_g) reg = setup_registration :iksnr => '39271', :package => package reg.should_receive(:packages).and_return [] package.should_receive(:registration).and_return reg flexmock(Package).should_receive(:find_by_pharmacode). times(1).and_return nil setup_meddata_server :ean13 => '7680392710281' @app.should_receive(:registration).and_return reg @app.should_receive(:each_package) expected_updates = {} ptr = Persistence::Pointer.new [:registration, '39271'] expected_updates.store ptr, { :generic_type => :original, :index_therapeuticus => '07.10.10.'} # expected_updates.store ptr, {} expected_pointer = ptr # ptr += [:sequence, '02'] # pac_pointer = ptr += [:package, '028'] @app.should_receive(:update).and_return do |pointer, update_data| assert_equal expected_pointer, pointer assert_equal expected_updates[pointer], update_data end @plugin.update_preparations StringIO.new(@sb_flag_src) end
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/bsv_xml.rb Loaded suite test/test_plugin/bsv_xml Started "getin in tag_end#Pack" . Finished in 0.029834 seconds. 1 tests, 3 assertions, 0 failures, 0 errors
Notes
Experiment
test/test_plugin/bsv_xml.rb
def test_update_preparation__update_only_SB_flag # prepare the same entry with load data, @src ## set up an package instance in the cache (@app) price_exfactory = Util::Money.new(2.9, 'exfactory', 'CH') price_exfactory.mutation_code="NORMAL" price_exfactory.origin= "http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (11.01.2011)" price_exfactory.valid_from = Time.local(2006,8,1) price_exfactory.authority = :sl price_public = Util::Money.new(7.5, 'public', 'CH') price_public.mutation_code="NORMAL" price_public.origin= "http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (11.01.2011)" price_public.valid_from = Time.local(2006,8,1) price_public.authority = :sl #package = setup_package :pharmacode => "987654", package = setup_package :pharmacode => "703279", :steps => %w{39271 02 028}, :price_public => price_public, :price_exfactory => price_exfactory #:sl_generic_type => :original, package.should_receive(:deductible).and_return(:deductible_o) package.should_receive(:deductible).and_return(:deductible_o) ## set up an registration on the cache reg = setup_registration :iksnr => '39271', :package => package, :generic_type => :original, :index_therapeuticus => '07.10.10.', reg.should_receive(:packages).and_return [] reg.should_receive(:sequence).and_return do flexmock('seq') do |seq| seq.should_receive(:package) end end package.should_receive(:registration).and_return reg flexmock(Package).should_receive(:find_by_pharmacode). times(1).and_return nil #times(1).and_return package setup_meddata_server :ean13 => '7680392710281' ## set the registration to the cache @app.should_receive(:registration).and_return reg @app.should_receive(:each_package) ## preparation of expected result expected_updates = {} ptr = Persistence::Pointer.new [:registration, '39271'] reg_pointer = ptr seq_pointer = ptr += [:sequence, '02'] pac_pointer = ptr += [:package, '028'] expected_pointer = pac_pointer expected_updates.store ptr, { :sl_generic_type => :original, :pharmacode => "703279", :narcotic => false, :deductible => :deductible_g, :price_public => price_public, :price_exfactory => price_exfactory } counter = 0 @app.should_receive(:update).and_return do |pointer, update_data| counter += 1 print "counter=", counter, "\n" if counter == 1 # update sequence assert_equal seq_pointer, pointer assert_equal({:atc_class=>"M01AG01"}, update_data) elsif counter == 2 # update package assert_equal expected_pointer, pointer assert_equal expected_updates[pointer], update_data elsif counter == 3 # update registration assert_equal reg_pointer, pointer assert_equal({:index_therapeuticus=>"07.10.10.", :generic_type=>:original}, update_data) end end @plugin.update_preparations StringIO.new(@sb_flag_src)
Result
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/bsv_xml.rb Loaded suite test/test_plugin/bsv_xml Started counter=1 counter=2 counter=3 . Finished in 0.032388 seconds. 1 tests, 7 assertions, 0 failures, 0 errors
Note
Consideration
Next
Reference
Next
if !@pcode.empty? && @pack && @pack.pharmacode \ && @pack.pharmacode != @pcode && @pack.pharmacode.to_i != 0 @report.store :pharmacode_oddb, @pack.pharmacode @conflict = true end
Note
Check test-cases
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/bsv_xml.rb Loaded suite test/test_plugin/bsv_xml Started ......... Finished in 0.144679 seconds. 9 tests, 71 assertions, 0 failures, 0 errors
Note
Run
Run update_bsv (with the latest XMLPublications.zip)
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_bsv
Result
Created SL-Entries 92 Updated SL-Entries 8364 Deleted SL-Entries 6 Created Limitation-Texts 16 Updated Limitation-Texts 1286 Deleted Limitation-Texts 0 Duplicate Registrations in SL 11.01.2011 0 Package-Data was completed from SL 0 SMeX/SL-Differences (Registrations) 11.01.2011 0 Critical Pharmacodes BAG-XML 11.01.2011 26 Missing Swissmedic-Codes in SL 11.01.2011 0 Missing Pharmacodes in SL 11.01.2011 268 Missing Swissmedic-Codes in SL (out of trade) 11.01.2011 37 Unknown Packages in SL 11.01.2011 29 Unknown Registrations in SL 11.01.2011 1 Unknown Packages in SL (out of trade) 11.01.2011 92 Packungen in der ODDB Total: 23259 Packungen ohne Pharmacode: 8625 - ausser Handel: 7790 - inaktive Registration: 671 - noch nicht auf MedWin: 164
Before
After
Commit
Reference
Notes
Check the package by the following website (for example, 'Thallous chloride')
Resolve
Result