3720: Clean up+skip Ruby SDK tests.
[arvados.git] / sdk / ruby / test / test_big_request.rb
1 require 'minitest/autorun'
2 require 'arvados'
3 require 'digest/md5'
4
5 class TestBigRequest < Minitest::Test
6   def boring_manifest nblocks
7     x = '.'
8     (0..nblocks).each do |z|
9       x += ' d41d8cd98f00b204e9800998ecf8427e+0'
10     end
11     x += " 0:0:foo.txt\n"
12     x
13   end
14
15   def test_create_manifest nblocks=1
16     skip "Test needs an API server to run against"
17     manifest_text = boring_manifest nblocks
18     uuid = Digest::MD5.hexdigest(manifest_text) + '+' + manifest_text.size.to_s
19     c = Arvados.new.collection.create(collection: {
20                                         uuid: uuid,
21                                         manifest_text: manifest_text,
22                                       })
23     assert_equal uuid, c[:portable_data_hash]
24   end
25
26   def test_create_big_manifest
27     # This ensures that manifest_text is passed in the request body:
28     # it's too large to fit in the query string.
29     test_create_manifest 9999
30   end
31 end