[Telepathy-commits] [telepathy-gabble/master] answer_error_to_pubsub_request: extract the node name from the request

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


20080703130744-7fe3f-54405719657fc0825d6a58f007ac394f0f1cdcfb.gz
---
 tests/twisted/olpc/current-activity.py     |    2 +-
 tests/twisted/olpc/olpc-activity-search.py |    2 +-
 tests/twisted/olpc/util.py                 |    7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/twisted/olpc/current-activity.py b/tests/twisted/olpc/current-activity.py
index 245d7c2..673686a 100644
--- a/tests/twisted/olpc/current-activity.py
+++ b/tests/twisted/olpc/current-activity.py
@@ -124,7 +124,7 @@ def test(q, bus, conn, stream):
     iq = event.stanza
 
     # Alice is not Bob's friend so she can't query his PEP node
-    answer_error_to_pubsub_request(stream, iq, NS_OLPC_CURRENT_ACTIVITY)
+    answer_error_to_pubsub_request(stream, iq)
 
     # so Bob is considererd without current activity
     q.expect('dbus-return', method='GetCurrentActivity',
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 02cc178..409234b 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -111,7 +111,7 @@ def test(q, bus, conn, stream):
     event = q.expect('stream-iq', to='lucien at localhost', query_name='pubsub',
             query_ns=NS_PUBSUB)
     # return an error, we can't query pubsub node
-    answer_error_to_pubsub_request(stream, event.stanza, NS_OLPC_ACTIVITIES)
+    answer_error_to_pubsub_request(stream, event.stanza)
 
     q.expect('dbus-return', method='GetActivities',
             value=([('activity1', handles['room1'])],))
diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py
index dccb56a..f84ac9a 100644
--- a/tests/twisted/olpc/util.py
+++ b/tests/twisted/olpc/util.py
@@ -125,8 +125,11 @@ def answer_to_current_act_pubsub_request(stream, request, id, room):
     activity['type'] = id
     reply.send()
 
-def answer_error_to_pubsub_request(stream, request, node):
-    # FIXME: we could find the node from the request
+def answer_error_to_pubsub_request(stream, request):
+    # look for node's name in the request
+    items = xpath.queryForNodes('/iq/pubsub/items', request)[0]
+    node = items['node']
+
     reply = IQ(stream, "error")
     reply['id'] = request['id']
     reply['from'] = request['to']
-- 
1.5.6.5




More information about the Telepathy-commits mailing list