From d1080a6888ad6fcc3dfe23a7fd910030fdcf0c94 Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 30 May 2012 16:09:50 +0400 Subject: enabled zip upload to update existing investigation/included modified valid test data BII-I-1b --- test/data/toxbank-investigation/valid/BII-I-1.zip | Bin 13684 -> 13640 bytes test/data/toxbank-investigation/valid/BII-I-1b.zip | Bin 0 -> 13651 bytes test/toxbank-investigation-rest.rb | 11 +++++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/data/toxbank-investigation/valid/BII-I-1b.zip diff --git a/test/data/toxbank-investigation/valid/BII-I-1.zip b/test/data/toxbank-investigation/valid/BII-I-1.zip index fbe4cdf..2ccbb4d 100644 Binary files a/test/data/toxbank-investigation/valid/BII-I-1.zip and b/test/data/toxbank-investigation/valid/BII-I-1.zip differ diff --git a/test/data/toxbank-investigation/valid/BII-I-1b.zip b/test/data/toxbank-investigation/valid/BII-I-1b.zip new file mode 100644 index 0000000..43629db Binary files /dev/null and b/test/data/toxbank-investigation/valid/BII-I-1b.zip differ diff --git a/test/toxbank-investigation-rest.rb b/test/toxbank-investigation-rest.rb index 1dcc3d2..b3cc05a 100644 --- a/test/toxbank-investigation-rest.rb +++ b/test/toxbank-investigation-rest.rb @@ -34,7 +34,7 @@ class BasicTestCRUDInvestigation < Test::Unit::TestCase # create an investigation by uploading a zip file def test_02_post_investigation @@uri = "" - file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", "BII-I-1.zip" + file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", "BII-I-1b.zip" #task_uri = `curl -k -X POST #{$toxbank_investigation[:uri]} -H "Content-Type: multipart/form-data" -F "file=@#{file};type=application/zip" -H "subjectid:#{@@subjectid}"` response = OpenTox::RestClientWrapper.post $toxbank_investigation[:uri], {:file => File.open(file)}, { :subjectid => @@subjectid } task_uri = response.chomp @@ -42,14 +42,21 @@ class BasicTestCRUDInvestigation < Test::Unit::TestCase task.wait uri = task.resultURI @@uri = URI(uri) + response = OpenTox::RestClientWrapper.get "#{@@uri}/metadata", {}, {:accept => "application/rdf+xml", :subjectid => @@subjectid} assert @@uri.host == URI($toxbank_investigation[:uri]).host + assert_match /[TBU\:U296]/, response + # POST zip on existing id + file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", "BII-I-1.zip" + OpenTox::RestClientWrapper.post "#{@@uri}", {:file => File.open(file)}, { :subjectid => @@subjectid } + response = OpenTox::RestClientWrapper.get "#{@@uri}/metadata", {}, {:accept => "application/rdf+xml", :subjectid => @@subjectid} + assert_match /[TBU\:U115]/, response end # get investigation/{id}/metadata in rdf and check contents def test_03_check_metadata response = OpenTox::RestClientWrapper.get "#{@@uri}/metadata", {}, {:accept => "application/rdf+xml", :subjectid => @@subjectid} assert_match /[Term Source Name, OBI, DOID, BTO, NEWT, UO, CHEBI, PATO, TBP, TBC, TBO, TBU, TBK]/, response - assert_match /[Investigation Identifier, BII\-I\-1]/, response + assert_match /[Investigation Identifier, [BII\-I\-1]]/, response assert_match /[Investigation Title, Growth control of the eukaryote cell\: a systems biology study in yeast]/, response assert_match /[Investigation Description, Background Cell growth underlies many key cellular and developmental processes]/, response assert_match /[Owning Organisation URI, TBO\:G176, Public]/, response -- cgit v1.2.3