1 # -*- encoding: binary -*-
5 class MogileFS::Backend
6 attr_accessor :timeout, :lasterr, :lasterrstr, :hosts
13 class TestClient < Test::Unit::TestCase
16 @client = MogileFS::Client.new :hosts => ['kaa:6001']
20 client = MogileFS::Client.new :hosts => ['kaa:6001']
22 assert_instance_of MogileFS::Backend, client.backend
23 assert_equal ['kaa:6001'], client.hosts
25 client = MogileFS::Client.new :hosts => ['kaa:6001'], :timeout => 5
26 assert_equal 5, client.backend.timeout
30 @client.backend.lasterr = 'you'
31 assert_equal 'you', @client.err
35 @client.backend.lasterrstr = 'totally suck'
36 assert_equal 'totally suck', @client.errstr
40 orig_backend = @client.backend
42 @client.hosts = ['ziz:6001']
45 assert_not_same @client.backend, orig_backend
46 assert_equal ['ziz:6001'], @client.backend.hosts
49 def test_readonly_eh_readonly
50 client = MogileFS::Client.new :hosts => ['kaa:6001'], :readonly => true
51 assert_equal true, client.readonly?
54 def test_readonly_eh_readwrite
55 assert_equal false, @client.readonly?