diff options
author | Seth Nickell <seth@gnome.org> | 2004-05-30 05:30:09 +0000 |
---|---|---|
committer | Seth Nickell <seth@gnome.org> | 2004-05-30 05:30:09 +0000 |
commit | 26c937cb302506c0f4dd96e2a1dd98535f167696 (patch) | |
tree | 8e02bc49599319c3aa62855b68da6ce5b6780f9b /python/tests/test-client.py | |
parent | 2e8a06bb8fa49b5b2163450654819fd26593cee4 (diff) |
2004-05-30 Seth Nickell <seth@gnome.org>
* python/dbus_bindings.pyx.in:
Add support for ObjectPath type.
* python/dbus.py:
Refactor message handling code to a common function.
* python/tests/test-client.py:
* python/tests/test-server.py:
Add tests that check to make sure values of all types
can be echoed from a service w/o mangling.
Diffstat (limited to 'python/tests/test-client.py')
-rw-r--r-- | python/tests/test-client.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/python/tests/test-client.py b/python/tests/test-client.py new file mode 100644 index 00000000..d12ee2aa --- /dev/null +++ b/python/tests/test-client.py @@ -0,0 +1,28 @@ +import dbus +import dbus_bindings + + +def TestEcho(value, should_be_equal = True): + global remote_object + echoed = remote_object.Echo(value) + if type(echoed) != type(value): + raise Exception ("Sending %s, expected echo of type %s, but got %s" % (value, type(value), type(echoed))) + + if echoed.__class__ != value.__class__: + raise Exception ("Sending %s, expected echo to be of class %s, but got %s" % (value, value.__class__, echoed.__class__)) + + if should_be_equal: + if echoed != value: + raise Exception("Sending %s, expected echo to be the same, but was %s" % (value, echoed)) + +session_bus = dbus.SessionBus() + +remote_service = session_bus.get_service("org.designfu.Test") +remote_object = remote_service.get_object("/TestObject", "org.designfu.Test") + +TestEcho(chr(120)) +TestEcho(10) +TestEcho(39.5) +TestEcho("HelloWorld") +TestEcho(dbus_bindings.ObjectPath("/test/path")) + |