[Telepathy-commits] [telepathy-gabble/master] olpc_test_helper: use elem() to create disco reply stanza
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:30 PDT 2008
20080702095020-7fe3f-5a9e7fac4777c5618b22aaaded3bbd2d7097c9ea.gz
---
tests/twisted/olpc/olpc_test_helper.py | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/olpc/olpc_test_helper.py b/tests/twisted/olpc/olpc_test_helper.py
index 81e2c60..88902b5 100644
--- a/tests/twisted/olpc/olpc_test_helper.py
+++ b/tests/twisted/olpc/olpc_test_helper.py
@@ -1,4 +1,4 @@
-from gabbletest import make_result_iq, acknowledge_iq
+from gabbletest import make_result_iq, acknowledge_iq, elem, elem_iq
from twisted.words.xish import domish, xpath
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
@@ -22,14 +22,11 @@ def announce_gadget(q, stream, disco_stanza):
# wait for Gadget disco#info query
event = q.expect('stream-iq', to='gadget.localhost', query_ns=NS_DISCO_INFO)
- reply = make_result_iq(stream, event.stanza)
- query = xpath.queryForNodes('/iq/query', reply)[0]
- identity = query.addElement((None, 'identity'))
- identity['category'] = 'collaboration'
- identity['type'] = 'gadget'
- identity['name'] = 'OLPC Gadget'
- feature = query.addElement((None, 'feature'))
- feature['var'] = NS_OLPC_BUDDY
- feature = query.addElement((None, 'feature'))
- feature['var'] = NS_OLPC_ACTIVITY
+
+ reply = elem_iq(stream, 'result', id=event.stanza['id'])(
+ elem(NS_DISCO_INFO, 'query')(
+ elem('identity', category='collaboration', type='gadget', name='OLPC Gadget')(),
+ elem('feature', var=NS_OLPC_BUDDY)(),
+ elem('feature', var=NS_OLPC_ACTIVITY)()))
+
stream.send(reply)
--
1.5.6.5
More information about the Telepathy-commits
mailing list