[Telepathy-commits] [telepathy-gabble/master] test-olpc-set-props-preload.py: port to new test API
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Tue Aug 19 10:52:09 PDT 2008
20080502104713-7fe3f-0fa5f73ccdd0f2f2461a87b7448589fe69ada4f5.gz
---
tests/twisted/olpc/test-olpc-set-props-preload.py | 38 ++++++---------------
1 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/tests/twisted/olpc/test-olpc-set-props-preload.py b/tests/twisted/olpc/test-olpc-set-props-preload.py
index 43cbb0e..88c06b4 100644
--- a/tests/twisted/olpc/test-olpc-set-props-preload.py
+++ b/tests/twisted/olpc/test-olpc-set-props-preload.py
@@ -6,23 +6,17 @@ Test connecting to a server.
import dbus
from twisted.words.xish import xpath
-from servicetest import match
-from gabbletest import go
+from servicetest import EventPattern
+from gabbletest import go, exec_test
- at match('dbus-signal', signal='StatusChanged', args=[1, 1])
-def expect_connecting(event, data):
- return True
-
- at match('stream-authenticated')
-def expect_authenticated(event, data):
- return True
+def test(q, bus, conn, stream):
+ buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
+ buddy_info_iface.SetProperties({'color': '#ff0000,#0000ff'})
- at match('dbus-signal', signal='StatusChanged', args=[0, 1])
-def expect_connected(event, data):
- return True
+ conn.Connect()
+ q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
- at match('stream-iq')
-def expect_transmit_properties(event, data):
+ event = q.expect('stream-iq')
iq = event.stanza
nodes = xpath.queryForNodes(
"/iq[@type='set']/pubsub[@xmlns='http://jabber.org/protocol/pubsub']"
@@ -42,19 +36,9 @@ def expect_transmit_properties(event, data):
assert text == '#ff0000,#0000ff', text
iq['type'] = 'result'
- data['stream'].send(iq)
- data['conn_iface'].Disconnect()
+ stream.send(iq)
+ conn.Disconnect()
return True
- at match('dbus-signal', signal='StatusChanged', args=[2, 1])
-def expect_disconnected(event, data):
- return True
-
-def start(data):
- data['buddy_info_iface'] = dbus.Interface(data['conn'],
- 'org.laptop.Telepathy.BuddyInfo')
- data['buddy_info_iface'].SetProperties({'color': '#ff0000,#0000ff'})
- data['conn_iface'].Connect()
-
if __name__ == '__main__':
- go(start=start)
+ exec_test(test)
--
1.5.6.3
More information about the Telepathy-commits
mailing list