def test(value): assert not dbusx.check_bus_name(name) msg = dbusx.Message(dbusx.MESSAGE_TYPE_METHOD_CALL) assert_raises(ValueError, setattr, msg, name, value) kwargs = { name: value } assert_raises(ValueError, dbusx.Message, dbusx.MESSAGE_TYPE_METHOD_CALL, **kwargs)
def test_echo_multiple_interfaces(self): proxy = self.proxy assert proxy.EchoString("foo") == "foo" assert proxy.EchoString("foo", interface=IFACE_FOO2) == "FOO" interfaces = proxy.interfaces proxy.interfaces = [] try: # with no search path, we may not guess assert_raises(dbusx.Error, proxy.EchoString, "foo") finally: proxy.interfaces = interfaces
def test_raise_invalid_error(self): proxy = self.proxy err = assert_raises(dbusx.Error, proxy.RaiseError, "1foo.bar") assert err.args[0] == "org.freedesktop.DBus.Error.Failed"
def test_RaiseError(self): proxy = self.proxy err = assert_raises(dbusx.Error, proxy.RaiseError, "foo.bar") assert err.args[0] == "foo.bar"
def test_return_wrong_arg_type(self): proxy = self.proxy assert_raises(dbusx.Error, proxy.EvalExpr, "1", "s") assert_raises(dbusx.Error, proxy.EvalExpr, '"foo"', "i")
def test_return_wrong_arg_count(self): proxy = self.proxy assert_raises(dbusx.Error, proxy.EvalExpr, "1", "") assert_raises(dbusx.Error, proxy.EvalExpr, "(1,)", "") assert_raises(dbusx.Error, proxy.EvalExpr, "(1,2)", "") assert_raises(dbusx.Error, proxy.EvalExpr, "(1,2)", "i") assert_raises(dbusx.Error, proxy.EvalExpr, "1", "ii") assert_raises(dbusx.Error, proxy.EvalExpr, "(1,2,3)", "ii")
def test(type): assert_raises(ValueError, dbusx.Message, type)
def _illegal_arg_value_test(self, sig, args): msg = dbusx.Message(dbusx.MESSAGE_TYPE_METHOD_CALL) assert_raises(ValueError, msg.set_args, sig, args)
def test(member): assert not dbusx.check_member(member) msg = dbusx.Message(dbusx.MESSAGE_TYPE_METHOD_CALL) assert_raises(ValueError, setattr, msg, 'member', member) assert_raises(ValueError, dbusx.Message, dbusx.MESSAGE_TYPE_METHOD_CALL, member=member)
def test(path): assert not dbusx.check_path(path) msg = dbusx.Message(dbusx.MESSAGE_TYPE_METHOD_CALL) assert_raises(ValueError, setattr, msg, 'path', path) assert_raises(ValueError, dbusx.Message, dbusx.MESSAGE_TYPE_METHOD_CALL, path=path)