[Telepathy-commits] [telepathy-gabble/master] olpc-buddy-search.py: send disco info about Gadget so we don't hardcode service's jid anymore
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:00 PDT 2008
20071214134909-7fe3f-263ef4bebc24d2423cb727352b96acdf27ed8dcb.gz
---
tests/olpc-buddy-search.py | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/tests/olpc-buddy-search.py b/tests/olpc-buddy-search.py
index 429b8d8..79037ed 100644
--- a/tests/olpc-buddy-search.py
+++ b/tests/olpc-buddy-search.py
@@ -16,20 +16,46 @@ NS_OLPC_CURRENT_ACTIVITY = "http://laptop.org/xmpp/current-activity"
NS_OLPC_ACTIVITY_PROPS = "http://laptop.org/xmpp/activity-properties"
NS_OLPC_BUDDY = "http://laptop.org/xmpp/buddy"
NS_OLPC_ACTIVITY = "http://laptop.org/xmpp/activity"
+
NS_PUBSUB = "http://jabber.org/protocol/pubsub"
+NS_DISCO_INFO = "http://jabber.org/protocol/disco#info"
+NS_DISCO_ITEMS = "http://jabber.org/protocol/disco#items"
+
NS_AMP = "http://jabber.org/protocol/amp"
def test(q, bus, conn, stream):
conn.Connect()
- _, iq_event = q.expect_many(
+ _, iq_event, disco_event = q.expect_many(
EventPattern('dbus-signal', signal='StatusChanged', args=[0, 1]),
EventPattern('stream-iq', to=None, query_ns='vcard-temp',
- query_name='vCard'))
+ query_name='vCard'),
+ EventPattern('stream-iq', to='localhost', query_ns=NS_DISCO_ITEMS))
acknowledge_iq(stream, iq_event.stanza)
+ # announce Gadget service
+ reply = make_result_iq(stream, disco_event.stanza)
+ query = xpath.queryForNodes('/iq/query', reply)[0]
+ item = query.addElement((None, 'item'))
+ item['jid'] = 'gadget.localhost'
+ stream.send(reply)
+
+ # 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
+ stream.send(reply)
+
buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
call_async(q, conn, 'RequestHandles', 1, ['bob at localhost'])
@@ -53,7 +79,7 @@ def test(q, bus, conn, stream):
stream.send(reply)
# wait for buddy search query
- event = q.expect('stream-iq', to='index.jabber.laptop.org',
+ event = q.expect('stream-iq', to='gadget.localhost',
query_ns=NS_OLPC_BUDDY)
buddies = xpath.queryForNodes('/iq/query/buddy', event.stanza)
assert len(buddies) == 1
--
1.5.6.5
More information about the Telepathy-commits
mailing list