[Telepathy-commits] [telepathy-gabble/master] renma olpc/olpc_test_helper to olpc/util.py
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:30 PDT 2008
20080702095910-7fe3f-24d2fa6a9a1ba98ba1d31d9cdc382a2cf601d1a2.gz
---
tests/twisted/olpc/change-notifications.py | 4 +-
tests/twisted/olpc/current-activity.py | 4 +-
tests/twisted/olpc/gadget-invite.py | 2 +-
tests/twisted/olpc/gadget-publish.py | 2 +-
tests/twisted/olpc/olpc-activity-search.py | 2 +-
tests/twisted/olpc/olpc-buddy-search.py | 2 +-
tests/twisted/olpc/olpc_test_helper.py | 32 ----------------------------
tests/twisted/olpc/util.py | 32 ++++++++++++++++++++++++++++
8 files changed, 40 insertions(+), 40 deletions(-)
delete mode 100644 tests/twisted/olpc/olpc_test_helper.py
create mode 100644 tests/twisted/olpc/util.py
diff --git a/tests/twisted/olpc/change-notifications.py b/tests/twisted/olpc/change-notifications.py
index bd14f48..66b52e6 100644
--- a/tests/twisted/olpc/change-notifications.py
+++ b/tests/twisted/olpc/change-notifications.py
@@ -9,7 +9,8 @@ from servicetest import call_async, EventPattern
from gabbletest import exec_test, make_result_iq, acknowledge_iq
from twisted.words.xish import domish, xpath
-from olpc_test_helper import announce_gadget
+
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
@@ -32,7 +33,6 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='localhost', query_ns=NS_DISCO_ITEMS))
acknowledge_iq(stream, iq_event.stanza)
-
announce_gadget(q, stream, disco_event.stanza)
# Alice, one our friends changed her properties
diff --git a/tests/twisted/olpc/current-activity.py b/tests/twisted/olpc/current-activity.py
index 80960a2..3a4d31a 100644
--- a/tests/twisted/olpc/current-activity.py
+++ b/tests/twisted/olpc/current-activity.py
@@ -9,7 +9,8 @@ from gabbletest import exec_test, make_result_iq, acknowledge_iq
from twisted.words.protocols.jabber.client import IQ
from twisted.words.xish import domish, xpath
-from olpc_test_helper import announce_gadget
+
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
@@ -34,7 +35,6 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='localhost', query_ns=NS_DISCO_ITEMS))
acknowledge_iq(stream, iq_event.stanza)
-
announce_gadget(q, stream, disco_event.stanza)
buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
diff --git a/tests/twisted/olpc/gadget-invite.py b/tests/twisted/olpc/gadget-invite.py
index 9929871..ceba617 100644
--- a/tests/twisted/olpc/gadget-invite.py
+++ b/tests/twisted/olpc/gadget-invite.py
@@ -10,7 +10,7 @@ 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 olpc_test_helper import announce_gadget
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
diff --git a/tests/twisted/olpc/gadget-publish.py b/tests/twisted/olpc/gadget-publish.py
index 1ef83eb..5cc9f7d 100644
--- a/tests/twisted/olpc/gadget-publish.py
+++ b/tests/twisted/olpc/gadget-publish.py
@@ -10,7 +10,7 @@ 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 olpc_test_helper import announce_gadget
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 3b30e9f..9ced730 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -9,7 +9,7 @@ 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 olpc_test_helper import announce_gadget
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
diff --git a/tests/twisted/olpc/olpc-buddy-search.py b/tests/twisted/olpc/olpc-buddy-search.py
index 73fe2a5..cdd0879 100644
--- a/tests/twisted/olpc/olpc-buddy-search.py
+++ b/tests/twisted/olpc/olpc-buddy-search.py
@@ -10,7 +10,7 @@ from gabbletest import exec_test, make_result_iq, acknowledge_iq
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber.client import IQ
-from olpc_test_helper import announce_gadget
+from util import announce_gadget
NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
diff --git a/tests/twisted/olpc/olpc_test_helper.py b/tests/twisted/olpc/olpc_test_helper.py
deleted file mode 100644
index 88902b5..0000000
--- a/tests/twisted/olpc/olpc_test_helper.py
+++ /dev/null
@@ -1,32 +0,0 @@
-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"
-NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
-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_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 announce_gadget(q, stream, disco_stanza):
- # announce Gadget service
- reply = make_result_iq(stream, disco_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 = 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)
diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py
new file mode 100644
index 0000000..88902b5
--- /dev/null
+++ b/tests/twisted/olpc/util.py
@@ -0,0 +1,32 @@
+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"
+NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
+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_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 announce_gadget(q, stream, disco_stanza):
+ # announce Gadget service
+ reply = make_result_iq(stream, disco_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 = 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