[Telepathy-commits] [telepathy-gabble/master] olpc-activity-search.py: use answer_error_to_pubsub_request

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:41 PDT 2008


20080703121939-7fe3f-ed2070f8f5de11b4df626f7e3573fe88557e24e2.gz
---
 tests/twisted/olpc/olpc-activity-search.py |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 5f0d289..bd8a84c 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -9,7 +9,8 @@ from gabbletest import exec_test, make_result_iq, acknowledge_iq, sync_stream
 
 from twisted.words.xish import domish, xpath
 from twisted.words.protocols.jabber.client import IQ
-from util import announce_gadget, request_random_activity_view
+from util import announce_gadget, request_random_activity_view,\
+    answer_error_to_pubsub_request
 
 NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
 NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
@@ -60,7 +61,6 @@ def test(q, bus, conn, stream):
                 [('lucien at localhost', {'color': ('str', '#AABBCC,#CCBBAA')}),
                  ('jean at localhost', {})]),])
 
-
     view0 = bus.get_object(conn.bus_name, view_path)
     view0_iface = dbus.Interface(view0, 'org.laptop.Telepathy.View')
 
@@ -101,19 +101,8 @@ def test(q, bus, conn, stream):
 
     event = q.expect('stream-iq', to='lucien at localhost', query_name='pubsub',
             query_ns=NS_PUBSUB)
-    iq = event.stanza
     # return an error, we can't query pubsub node
-    reply = IQ(stream, "error")
-    reply['id'] = iq['id']
-    reply['from'] = iq['to']
-    pubsub = reply.addElement((NS_PUBSUB, 'pubsub'))
-    items = pubsub.addElement((None, 'items'))
-    items['node'] = 'http://laptop.org/xmpp/activities'
-    error = reply.addElement((None, 'error'))
-    error['type'] = 'auth'
-    error.addElement((NS_STANZA, 'not-authorized'))
-    error.addElement(("%s#errors" % NS_PUBSUB, 'presence-subscription-required'))
-    stream.send(reply)
+    answer_error_to_pubsub_request(stream, event.stanza, NS_OLPC_ACTIVITIES)
 
     q.expect('dbus-return', method='GetActivities',
             value=([('activity1', handles['room1'])],))
-- 
1.5.6.5




More information about the Telepathy-commits mailing list