PubChem classification download
[lazar] / test / download.rb
1 require_relative "setup.rb"
2
3 class DownloadTest < MiniTest::Test
4
5   def test_pubchem_classification
6     Download.pubchem_classification aid: 1191, active: "carcinogen", inactive: "non-carcinogen", species: "Hamster", endpoint: "Carcinogen"
7     csv = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.csv")
8     meta_file = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.json")
9     assert File.exists?(csv)
10     table = CSV.read csv
11     assert_equal 87, table.size
12     assert_equal ["48413129", "CC=O", "carcinogen"], table[1]
13     meta = JSON.parse(File.read(meta_file))
14     assert_equal "Hamster", meta["species"]
15     assert_equal 1, meta["warnings"].size
16     FileUtils.rm(csv)
17     FileUtils.rm(meta_file)
18   end
19
20 end
21
22