From 71714a372cf4e59e219f02d96453944ade6994e5 Mon Sep 17 00:00:00 2001 From: Dafydd Harries Date: Wed, 23 Sep 2009 16:27:22 +0100 Subject: presence.py: use make_presence() --- tests/twisted/presence/presence.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py index 901c88cae..2903544e7 100644 --- a/tests/twisted/presence/presence.py +++ b/tests/twisted/presence/presence.py @@ -6,7 +6,7 @@ FIXME: test C.I.Presence too from twisted.words.xish import domish -from gabbletest import exec_test +from gabbletest import exec_test, make_presence from servicetest import EventPattern import ns import constants as cs @@ -28,27 +28,15 @@ def test(q, bus, conn, stream): item['subscription'] = 'both' stream.send(event.stanza) + stream.send(make_presence('amy@foo.com', show='away', status='At the pub')) - presence = domish.Element((None, 'presence')) - presence['from'] = 'amy@foo.com' - show = presence.addElement((None, 'show')) - show.addContent('away') - status = presence.addElement((None, 'status')) - status.addContent('At the pub') - stream.send(presence) - - event = q.expect('dbus-signal', signal='PresencesChanged', + q.expect('dbus-signal', signal='PresencesChanged', args=[{amy_handle: (3, 'away', 'At the pub')}]) - presence = domish.Element((None, 'presence')) - presence['from'] = 'amy@foo.com' - show = presence.addElement((None, 'show')) - show.addContent('chat') - status = presence.addElement((None, 'status')) - status.addContent('I may have been drinking') - stream.send(presence) + stream.send(make_presence( + 'amy@foo.com', show='chat', status='I may have been drinking')) - event = q.expect('dbus-signal', signal='PresencesChanged', + q.expect('dbus-signal', signal='PresencesChanged', args=[{amy_handle: (2, 'chat', 'I may have been drinking')}]) if __name__ == '__main__': -- cgit v1.2.3