2 # -*- encoding: binary -*-
3 require './test/integration'
5 class TestMogileFSIntegrationListKeys < TestMogIntegration
8 @client = MogileFS::MogileFS.new(:hosts => @trackers, :domain => @domain)
13 k.each { |x| @client.store_content("lk_#{x}", nil, x) }
14 expect = k.map { |x| "lk_#{x}" }
15 rv = @client.list_keys
16 assert_equal([ expect, expect.last ] , rv)
18 @client.list_keys do |key, length, devcount|
19 assert_equal 1, length
20 assert_kind_of Integer, devcount
21 assert_equal expect[nr], key
26 def test_list_keys_strange
27 @client.store_content("hello+world", nil, "HI")
28 rv = @client.list_keys
29 assert_equal "hello+world", rv[0][0]
33 9.times { |i| @client.store_content("ek_#{i}", nil, i.to_s) }
35 @client.each_key do |key|
36 assert_equal "ek_#{n.to_s}", key
42 def test_each_file_info
43 9.times { |i| @client.store_content("ek_#{i}", nil, i.to_s) }
45 @client.each_file_info do |info|
46 assert_equal @client.domain, info["domain"]
47 assert_equal n.to_s.size, info["length"]
48 assert_kind_of Integer, info["fid"]
49 assert_kind_of Integer, info["devcount"]
50 assert_equal "default", info["class"]
51 assert_equal "ek_#{n}", info["key"]