2
# Test that a server survives various error cases
6
class ServerRobustnessTest < Test::Unit::TestCase
8
@bus = DBus::SessionBus.instance
9
@svc = @bus.service("org.ruby.service")
12
# https://trac.luon.net/ruby-dbus/ticket/31
13
# the server should not crash
14
def test_no_such_path_with_introspection
15
obj = @svc.object "/org/ruby/NotMyInstance"
17
assert false, "should have raised"
18
rescue DBus::Error => e
19
assert_no_match(/timeout/, e)
22
def test_no_such_path_without_introspection
23
obj = @svc.object "/org/ruby/NotMyInstance"
24
ifc = DBus::ProxyObjectInterface.new(obj, "org.ruby.SampleInterface")
25
ifc.define_method("the_answer", "out n:i")
27
assert false, "should have raised"
28
rescue DBus::Error => e
29
assert_no_match(/timeout/, e)
32
def test_a_method_that_raises
33
obj = @svc.object "/org/ruby/MyInstance"
35
obj.default_iface = "org.ruby.SampleInterface"
37
assert false, "should have raised"
38
rescue DBus::Error => e
39
assert_no_match(/timeout/, e)