Ruby mogilefs-client 3.4.0
[ruby-mogilefs-client.git] / test / test_fresh.rb
blobf20aacce14154369cecc3303fcac77a780170ecd
1 # -*- encoding: binary -*-
2 require "./test/fresh"
4 class TestMogFresh < Test::Unit::TestCase
5   include TestFreshSetup
6   alias setup setup_mogilefs
7   alias teardown teardown_mogilefs
9   def test_change_device_weight
10     add_host_device_domain
11     assert_equal true, @admin.change_device_weight("me", 1, 50)
12     assert_equal 50, @admin.get_devices(1)[0]["weight"]
13   end
15   def test_list_keys_invalid_domain
16     add_host_device_domain
17     domain = @domain + ".non-existent"
18     client = MogileFS::MogileFS.new :hosts => @hosts, :domain => domain
19     assert_raises(MogileFS::Backend::UnregDomainError) do
20       client.list_keys
21     end
22   end
24   def test_invalid_key_exists
25     add_host_device_domain
26     domain = @domain + ".non-existent"
27     client = MogileFS::MogileFS.new :hosts => @hosts, :domain => domain
28     assert_raises(MogileFS::Backend::UnregDomainError) do
29       client.exist?("FOO")
30     end
32     client = MogileFS::MogileFS.new :hosts => @hosts, :domain => @domain
33     assert_equal false, client.exist?("non-existent")
34   end
35 end