add acl to drb server
[god.git] / test / test_server.rb
blob438616977ce0c33d1c8b44722d38566a9bfe7efe
1 require File.dirname(__FILE__) + '/helper'
3 class TestServer < Test::Unit::TestCase
4   def setup
5     silence_warnings do 
6       Object.const_set(:DRb, stub_everything)
7     end
8   end
10   def test_should_start_a_drb_server
11     DRb.expects(:start_service)
12     no_stdout do
13       Server.new
14     end
15   end
17   def test_should_use_supplied_port_and_host
18     DRb.expects(:start_service).with { |uri, object| uri == "druby://host:port" && object.is_a?(Server) }
19     no_stdout do
20       server = Server.new('host', 'port')
21     end
22   end
24   def test_should_forward_foreign_method_calls_to_god
25     server = nil
26     no_stdout do
27       server = Server.new
28     end
29     God.expects(:send).with(:something_random)
30     server.something_random
31   end
32   
33   def test_should_install_deny_all_by_default
34     ACL.expects(:new).with(%w{deny all})
35     no_stdout do
36       Server.new
37     end
38   end
39   
40   def test_should_install_pass_through_acl
41     ACL.expects(:new).with(%w{deny all allow localhost allow 0.0.0.0})
42     no_stdout do
43       Server.new(nil, 17165, %w{localhost 0.0.0.0})
44     end
45   end
46 end