[telepathy-gabble/telepathy-gabble-0.8] make send_disco_reply() take a list of identities
Dafydd Harries
dafydd.harries at collabora.co.uk
Wed Jan 6 12:41:34 PST 2010
---
tests/twisted/caps/caps-cache.py | 2 +-
tests/twisted/caps/from-bare-jid.py | 6 +++---
tests/twisted/caps/hashed-caps.py | 11 ++++++-----
tests/twisted/caps_helper.py | 16 ++++++++++++----
tests/twisted/jingle/jingletest.py | 2 +-
tests/twisted/test-fallback-socks5-proxy.py | 3 ++-
tests/twisted/tubes/offer-private-dbus-tube.py | 2 +-
7 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/tests/twisted/caps/caps-cache.py b/tests/twisted/caps/caps-cache.py
index ddbe36c..db542f9 100644
--- a/tests/twisted/caps/caps-cache.py
+++ b/tests/twisted/caps/caps-cache.py
@@ -78,7 +78,7 @@ def test(q, bus, conn, stream):
# Jens' first client replies. We don't expect any caps changes here, and
# this shouldn't count as a second point towards the five we need to trust
# this caps node.
- send_disco_reply(stream, j_stanza, features)
+ send_disco_reply(stream, j_stanza, [], features)
check_caps (conn, j)
update_contact_caps (q, conn, stream, 'bob5 at foo.com/Foo', caps)
diff --git a/tests/twisted/caps/from-bare-jid.py b/tests/twisted/caps/from-bare-jid.py
index 22f9c6e..6884ad9 100644
--- a/tests/twisted/caps/from-bare-jid.py
+++ b/tests/twisted/caps/from-bare-jid.py
@@ -43,7 +43,7 @@ def test(q, bus, conn, stream):
assertEquals(client + '#' + caps['ver'], query_node.attributes['node'])
# The bare jid replies
- send_disco_reply(stream, event.stanza, features, {})
+ send_disco_reply(stream, event.stanza, [], features)
# Gabble lets us know their caps have changed. (Gabble used to ignore the
# reply.)
@@ -95,10 +95,10 @@ def test(q, bus, conn, stream):
# The bare jid replies! Getting a disco reply from a bare JID when we've
# got presence from resources used to crash Gabble, but now it just ignores
# it.
- send_disco_reply(stream, disco2.stanza, features, {})
+ send_disco_reply(stream, disco2.stanza, [], features)
# Now the resourceful JID replies:
- send_disco_reply(stream, disco3.stanza, features_, {})
+ send_disco_reply(stream, disco3.stanza, [], features_)
# Gabble should announce that the contact has acquired some caps.
e = q.expect('dbus-signal', signal='CapabilitiesChanged')
diff --git a/tests/twisted/caps/hashed-caps.py b/tests/twisted/caps/hashed-caps.py
index c50e052..8b03915 100644
--- a/tests/twisted/caps/hashed-caps.py
+++ b/tests/twisted/caps/hashed-caps.py
@@ -80,7 +80,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
client + '#' + '0.1'
# send good reply
- send_disco_reply(stream, event.stanza, jingle_av_features)
+ send_disco_reply(stream, event.stanza, [], jingle_av_features)
# we can now do audio calls
event = q.expect('dbus-signal', signal='CapabilitiesChanged')
@@ -103,7 +103,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
client + '#' + caps['ver']
# send bogus reply
- send_disco_reply(stream, event.stanza,
+ send_disco_reply(stream, event.stanza, [],
['http://jabber.org/protocol/bogus-feature'])
# don't receive any D-Bus signal
@@ -164,7 +164,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# send good reply
send_disco_reply(
- stream, event.stanza, jingle_av_features, fake_client_dataforms)
+ stream, event.stanza, [], jingle_av_features, fake_client_dataforms)
# we can now do audio calls
event = q.expect('dbus-signal', signal='CapabilitiesChanged',
@@ -227,7 +227,8 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
sync_dbus(bus, q, conn)
assert caps_changed_flag == False
- result = make_caps_disco_reply(stream, event.stanza, jingle_av_features)
+ result = make_caps_disco_reply(
+ stream, event.stanza, [], jingle_av_features)
if broken_hash:
# make the hash break!
@@ -250,7 +251,7 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
assert caps_changed_flag == False
# send good reply
- send_disco_reply(stream, event.stanza, jingle_av_features)
+ send_disco_reply(stream, event.stanza, [], jingle_av_features)
# we can now do audio calls with both contacts
event = q.expect('dbus-signal', signal='CapabilitiesChanged',
diff --git a/tests/twisted/caps_helper.py b/tests/twisted/caps_helper.py
index 2c5b40a..5a18542 100644
--- a/tests/twisted/caps_helper.py
+++ b/tests/twisted/caps_helper.py
@@ -163,10 +163,17 @@ def compute_caps_hash(identities, features, dataforms):
m.update(S.encode('utf-8'))
return base64.b64encode(m.digest())
-def make_caps_disco_reply(stream, req, features, dataforms={}):
+def make_caps_disco_reply(stream, req, identities, features, dataforms={}):
iq = make_result_iq(stream, req)
query = iq.firstChildElement()
+ for identity in identities:
+ category, type_, lang, name = identity.split('/')
+ el = query.addElement('identity')
+ el['category'] = category
+ el['type'] = type_
+ el['name'] = name
+
for f in features:
el = domish.Element((None, 'feature'))
el['var'] = f
@@ -258,7 +265,7 @@ def presence_and_disco(q, conn, stream, contact, disco,
if disco:
stanza = expect_disco(q, contact, client, caps)
- send_disco_reply(stream, stanza, features, dataforms)
+ send_disco_reply(stream, stanza, [], features, dataforms)
return h
@@ -292,8 +299,9 @@ def expect_disco(q, contact, client, caps):
return event.stanza
-def send_disco_reply(stream, stanza, features, dataforms={}):
- stream.send(make_caps_disco_reply(stream, stanza, features, dataforms))
+def send_disco_reply(stream, stanza, identities, features, dataforms={}):
+ stream.send(
+ make_caps_disco_reply(stream, stanza, identities, features, dataforms))
if __name__ == '__main__':
# example from XEP-0115
diff --git a/tests/twisted/jingle/jingletest.py b/tests/twisted/jingle/jingletest.py
index 2a9e713..e7ee44a 100644
--- a/tests/twisted/jingle/jingletest.py
+++ b/tests/twisted/jingle/jingletest.py
@@ -109,7 +109,7 @@ class JingleTest:
def send_remote_disco_reply(self, stanza):
- send_disco_reply(self.stream, stanza, self.remote_feats)
+ send_disco_reply(self.stream, stanza, [], self.remote_feats)
def incoming_call(self, codec_parameters=None):
self.direction = 'incoming'
diff --git a/tests/twisted/test-fallback-socks5-proxy.py b/tests/twisted/test-fallback-socks5-proxy.py
index a7ed358..38bb0c9 100644
--- a/tests/twisted/test-fallback-socks5-proxy.py
+++ b/tests/twisted/test-fallback-socks5-proxy.py
@@ -42,7 +42,8 @@ def connect_and_announce_alice(q, bus, conn, stream):
disco_event = q.expect('stream-iq', to='alice at localhost/Test',
query_ns=ns.DISCO_INFO)
- send_disco_reply(stream, disco_event.stanza, [ns.TUBES, ns.FILE_TRANSFER])
+ send_disco_reply(
+ stream, disco_event.stanza, [], [ns.TUBES, ns.FILE_TRANSFER])
sync_stream(q, stream)
q.unforbid_events(proxy_query_events)
diff --git a/tests/twisted/tubes/offer-private-dbus-tube.py b/tests/twisted/tubes/offer-private-dbus-tube.py
index 5fd3b7b..6ad0f80 100644
--- a/tests/twisted/tubes/offer-private-dbus-tube.py
+++ b/tests/twisted/tubes/offer-private-dbus-tube.py
@@ -305,7 +305,7 @@ def test(q, bus, conn, stream, bytestream_cls, access_control):
)
# reply to disco query
- send_disco_reply(stream, disco_event.stanza, [ns.TUBES])
+ send_disco_reply(stream, disco_event.stanza, [], [ns.TUBES])
sync_stream(q, stream)
--
1.5.6.5
More information about the telepathy-commits
mailing list