Skip to content

Commit

Permalink
(#237) Fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Feb 23, 2024
1 parent 92b9905 commit 3a8d9f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/plugin/text_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def initialize app, opts={:newest => true}
@fi_atc_code_missmatch = []
@target_keys = Util::COLUMNS_FEBRUARY_2019
@iksnrs_meta_info = {}
@specify_barcode_to_text_info ||= {}
@skipped_override ||= []
@missing_override ||= {}
end
Expand Down
11 changes: 7 additions & 4 deletions test/test_plugin/text_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def teardown
end

def setup
path_check = File.expand_path(File.join(File.dirname(__FILE__), '../../etc', 'barcode_minitest.yml'))
assert_equal(ODDB::TextInfoPlugin::Override_file, path_check)
FileUtils.rm_f(path_check, :verbose => true)
pointer = flexmock 'pointer'
@aips_download = File.expand_path('../data/xml/Aips_test.xml', File.dirname(__FILE__))
latest_from = File.expand_path('../data/xlsx/Packungen-latest.xlsx', File.dirname(__FILE__))
Expand Down Expand Up @@ -331,12 +334,12 @@ def test_import_daily_packungen
old_missing = {'680109990223_pi_de' => 'Osanit® Kügelchen',
'7680109990223_pi_fr' => 'Osanit® globules',
'7680109990224_pi_fr' => 'Test mit langem Namen der nicht umgebrochen sein sollte mehr als 80 Zeichen lang'}
real_override_file = File.join(Dir.pwd, 'etc', 'barcode_to_text_info.yml')
assert(true, File.exist?(real_override_file))
real_override_file = File.join(File.dirname(__FILE__), '../../etc', 'barcode_to_text_info.yml')
assert_equal(false, File.exist?(ODDB::TextInfoPlugin::Override_file), "File #{ODDB::TextInfoPlugin::Override_file} must not exist")
assert_equal(true, File.exist?(real_override_file), "File #{real_override_file} must exist")
real_overrides = YAML.load(File.read(real_override_file))
assert_equal(true, real_overrides.size > 0, 'Must have read some real overrides')
File.open(ODDB::TextInfoPlugin::Override_file, 'w+' ) do |out|
YAML.dump(old_missing, out )
YAML.dump(old_missing, out)
end
assert_equal(5, File.readlines(ODDB::TextInfoPlugin::Override_file).size, 'File must be now 5 lines long, as one is too long')
old_time = File.ctime(ODDB::TextInfoPlugin::Override_file)
Expand Down
7 changes: 3 additions & 4 deletions test/test_plugin/text_info_swissmedicinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,9 @@ def test_import_patinfo_tramal_43788
replace_constant('ODDB::RefdataPlugin::REFDATA_SERVER', @server) do
assert(@plugin.import_swissmedicinfo(@opts), 'must be able to run import_swissmedicinfo')
end
[ @plugin.problematic_fi_pi, @plugin.missing_override_file].each do |filename|
assert(File.exist?(filename))
# assert(File.size(filename) > 100, "#{filename} must be longer than 100 chars, but is only #{File.size(filename)}")
end
assert(File.exist?(@plugin.problematic_fi_pi), "Datei #{ @plugin.problematic_fi_pi} must exist")
path = File.join(File.dirname(__FILE__), '../../doc/resources/images/pi/de/43788Tramal_Tropfen__L_sung_zum_Einnehmen_files/1.png')
assert(File.exist?(path), "Created image file #{path} must exist")
@app.registration('15219').packages.size
@app.registration('15219').packages.values.find_all { |x| x.patinfo}
@app.registration('15219').sequences.values.find_all { |x| x.patinfo}
Expand Down

0 comments on commit 3a8d9f7

Please sign in to comment.