[telepathy-gabble/master] Constants-ify test-alias-pep
Will Thompson
will.thompson at collabora.co.uk
Tue May 19 08:43:40 PDT 2009
---
tests/twisted/ns.py | 1 +
tests/twisted/vcard/test-alias-pep.py | 26 +++++++++++++++-----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/ns.py b/tests/twisted/ns.py
index 28aaa35..9655247 100644
--- a/tests/twisted/ns.py
+++ b/tests/twisted/ns.py
@@ -17,6 +17,7 @@ MUC = 'http://jabber.org/protocol/muc'
MUC_BYTESTREAM = 'http://telepathy.freedesktop.org/xmpp/protocol/muc-bytestream'
MUC_OWNER = '%s#owner' % MUC
MUC_USER = '%s#user' % MUC
+NICK = "http://jabber.org/protocol/nick"
OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
OLPC_ACTIVITIES_NOTIFY = "%s+notify" % OLPC_ACTIVITIES
OLPC_ACTIVITY = "http://laptop.org/xmpp/activity"
diff --git a/tests/twisted/vcard/test-alias-pep.py b/tests/twisted/vcard/test-alias-pep.py
index e44b780..0375061 100644
--- a/tests/twisted/vcard/test-alias-pep.py
+++ b/tests/twisted/vcard/test-alias-pep.py
@@ -3,33 +3,36 @@
Test PEP alias support.
"""
-from servicetest import call_async, EventPattern
+from servicetest import call_async, EventPattern, assertEquals
from gabbletest import exec_test, make_result_iq, acknowledge_iq
+import constants as cs
+import ns
+
def test(q, bus, conn, stream):
conn.Connect()
_, event = q.expect_many(
- EventPattern('dbus-signal', signal='StatusChanged', args=[0, 1]),
+ EventPattern('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]),
EventPattern('stream-iq', to=None, query_ns='vcard-temp',
query_name='vCard'))
acknowledge_iq(stream, event.stanza)
- handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
+ handle = conn.RequestHandles(cs.HT_CONTACT, ['bob at foo.com'])[0]
call_async(q, conn.Aliasing, 'RequestAliases', [handle])
event = q.expect('stream-iq', to='bob at foo.com', iq_type='get',
- query_ns='http://jabber.org/protocol/pubsub', query_name='pubsub')
+ query_ns=ns.PUBSUB, query_name='pubsub')
items = event.query.firstChildElement()
- assert items.name == 'items'
- assert items['node'] == "http://jabber.org/protocol/nick"
+ assertEquals('items', items.name)
+ assertEquals(ns.NICK, items['node'])
result = make_result_iq(stream, event.stanza)
pubsub = result.firstChildElement()
items = pubsub.addElement('items')
- items['node'] = 'http://jabber.org/protocol/nick'
+ items['node'] = ns.NICK
item = items.addElement('item')
- item.addElement('nick', 'http://jabber.org/protocol/nick',
- content='Bobby')
+ item.addElement('nick', ns.NICK, content='Bobby')
stream.send(result)
q.expect('dbus-signal', signal='AliasesChanged',
@@ -38,10 +41,11 @@ def test(q, bus, conn, stream):
value=(['Bobby'],))
# A second request should be satisfied from the cache.
- assert conn.Aliasing.RequestAliases([handle]) == ['Bobby']
+ assertEquals(['Bobby'], conn.Aliasing.RequestAliases([handle]))
conn.Disconnect()
- q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+ q.expect('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_REQUESTED]),
if __name__ == '__main__':
exec_test(test)
--
1.5.6.5
More information about the telepathy-commits
mailing list