1 # -*- encoding: binary -*-
5 class MogileFS::Backend
6 attr_accessor :timeout, :hosts
7 attr_writer :lasterr, :lasterrstr
10 class MogileFS::Client
14 class TestClient < Test::Unit::TestCase
17 @client = MogileFS::Client.new :hosts => ['kaa:6001']
21 client = MogileFS::Client.new :hosts => ['kaa:6001']
23 assert_instance_of MogileFS::Backend, client.backend
24 assert_equal ['kaa:6001'], client.hosts
26 client = MogileFS::Client.new :hosts => ['kaa:6001'], :timeout => 5
27 assert_equal 5, client.backend.timeout
31 @client.backend.lasterr = 'you'
32 assert_equal 'you', @client.err
36 @client.backend.lasterrstr = 'totally suck'
37 assert_equal 'totally suck', @client.errstr
41 orig_backend = @client.backend
43 @client.hosts = ['ziz:6001']
46 assert_not_same @client.backend, orig_backend
47 assert_equal ['ziz:6001'], @client.backend.hosts
50 def test_readonly_eh_readonly
51 client = MogileFS::Client.new :hosts => ['kaa:6001'], :readonly => true
52 assert_equal true, client.readonly?
55 def test_readonly_eh_readwrite
56 assert_equal false, @client.readonly?