1 # -*- encoding: binary -*-
4 class TestMogileFSIntegrationListKeys < Test::Unit::TestCase
10 @client = MogileFS::MogileFS.new(:hosts => @trackers, :domain => @domain)
13 alias teardown teardown_mogilefs
17 k.each { |x| @client.store_content("lk_#{x}", nil, x) }
18 expect = k.map { |x| "lk_#{x}" }
19 rv = @client.list_keys
20 assert_equal([ expect, expect.last ] , rv)
22 @client.list_keys do |key, length, devcount|
23 assert_equal 1, length
24 assert_kind_of Integer, devcount
25 assert_equal expect[nr], key
30 def test_list_keys_strange
31 @client.store_content("hello+world", nil, "HI")
32 rv = @client.list_keys
33 assert_equal "hello+world", rv[0][0]
37 9.times { |i| @client.store_content("ek_#{i}", nil, i.to_s) }
39 @client.each_key do |key|
40 assert_equal "ek_#{n.to_s}", key
46 def test_each_file_info
47 9.times { |i| @client.store_content("ek_#{i}", nil, i.to_s) }
49 @client.each_file_info do |info|
50 assert_equal @client.domain, info["domain"]
51 assert_equal n.to_s.size, info["length"]
52 assert_kind_of Integer, info["fid"]
53 assert_kind_of Integer, info["devcount"]
54 assert_equal "default", info["class"]
55 assert_equal "ek_#{n}", info["key"]