summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-08-25 15:17:31 (GMT)
committerWill Thompson <will.thompson@collabora.co.uk>2009-08-25 15:43:36 (GMT)
commit9061297322a89f622452b99237ffa39c90a6f124 (patch)
tree74d418e1268aa8645d18ca341eafaa0e73374251 /tests
parent81d7cb45a2c21910ef6f340f338f3769f636dd5a (diff)
downloadtelepathy-haze-9061297322a89f622452b99237ffa39c90a6f124.tar.gz
telepathy-haze-9061297322a89f622452b99237ffa39c90a6f124.tar.xz
Tests: Respond to roster gets with the empty roster
Recent versions of prpl-jabber wait for a reply to its initial roster pull before declaring the connection to be online. So, let's just answer with the empty roster for now.
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/hazetest.py9
-rw-r--r--tests/twisted/presence/presence.py12
2 files changed, 16 insertions, 5 deletions
diff --git a/tests/twisted/hazetest.py b/tests/twisted/hazetest.py
index e1a817b..dba64d9 100644
--- a/tests/twisted/hazetest.py
+++ b/tests/twisted/hazetest.py
@@ -240,6 +240,9 @@ class BaseXmlStream(xmlstream.XmlStream):
self.addObserver(
"/iq/query[@xmlns='http://jabber.org/protocol/disco#info']",
self._cb_disco_iq)
+ self.addObserver(
+ "/iq/query[@xmlns='jabber:iq:roster']",
+ self._cb_roster_get)
self.event_func(servicetest.Event('stream-authenticated'))
def _cb_disco_iq(self, iq):
@@ -256,6 +259,12 @@ class BaseXmlStream(xmlstream.XmlStream):
iq['type'] = 'result'
self.send(iq)
+ def _cb_roster_get(self, iq):
+ # Just send back an empty roster. prpl-jabber waits for the roster
+ # before saying it's online.
+ if iq.getAttribute('type') == 'get':
+ self.send(make_result_iq(self, iq))
+
class JabberXmlStream(BaseXmlStream):
version = (0, 9)
diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py
index 9adf25a..dea36a3 100644
--- a/tests/twisted/presence/presence.py
+++ b/tests/twisted/presence/presence.py
@@ -7,6 +7,7 @@ FIXME: test C.I.Presence too
import dbus
from twisted.words.xish import domish, xpath
+from twisted.words.protocols.jabber.client import IQ
from hazetest import exec_test
@@ -16,14 +17,15 @@ def test(q, bus, conn, stream):
amy_handle = conn.RequestHandles(1, ['amy@foo.com'])[0]
- event = q.expect('stream-iq', query_ns='jabber:iq:roster')
- event.stanza['type'] = 'result'
-
- item = event.query.addElement('item')
+ # Divergence from Gabble: hazetest responds to all roster gets with an
+ # empty roster, so we need to push the roster.
+ iq = IQ(stream, 'set')
+ query = iq.addElement(('jabber:iq:roster', 'query'))
+ item = query.addElement('item')
item['jid'] = 'amy@foo.com'
item['subscription'] = 'both'
- stream.send(event.stanza)
+ stream.send(iq)
presence = domish.Element((None, 'presence'))
presence['from'] = 'amy@foo.com'