summaryrefslogtreecommitdiff
path: root/tests/twisted/text/initiate-requestotron.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/twisted/text/initiate-requestotron.py')
-rw-r--r--tests/twisted/text/initiate-requestotron.py28
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py
index c543b69..41b9407 100644
--- a/tests/twisted/text/initiate-requestotron.py
+++ b/tests/twisted/text/initiate-requestotron.py
@@ -7,7 +7,10 @@ import dbus
from twisted.words.xish import domish
from hazetest import exec_test
-from servicetest import call_async, EventPattern
+from servicetest import (call_async, EventPattern, unwrap, assertEquals,
+ assertLength, assertContains)
+
+import pprint
import constants as cs
@@ -43,9 +46,8 @@ def test(q, bus, conn, stream):
'org.freedesktop.Telepathy.Channel.TargetHandle': foo_handle,
})
- ret, old_sig, new_sig = q.expect_many(
+ ret, sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannel'),
EventPattern('dbus-signal', signal='NewChannels'),
)
@@ -65,25 +67,17 @@ def test(q, bus, conn, stream):
assert emitted_props['org.freedesktop.Telepathy.Channel.'
'InitiatorID'] == 'test@localhost'
- assert old_sig.args[0] == ret.value[0]
- assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
- # check that handle type == contact handle
- assert old_sig.args[2] == 1
- assert old_sig.args[3] == foo_handle
- assert old_sig.args[4] == True # suppress handler
-
- assert len(new_sig.args) == 1
- assert len(new_sig.args[0]) == 1 # one channel
- assert len(new_sig.args[0][0]) == 2 # two struct members
- assert new_sig.args[0][0][0] == ret.value[0]
- assert new_sig.args[0][0][1] == ret.value[1]
+ assertLength(1, sig.args)
+ assertLength(1, sig.args[0]) # one channel
+ assertLength(2, sig.args[0][0]) # two struct members
+ assertEquals(ret.value[0], sig.args[0][0][0])
+ assertEquals(ret.value[1], sig.args[0][0][1])
properties = conn.GetAll(
'org.freedesktop.Telepathy.Connection.Interface.Requests',
dbus_interface=dbus.PROPERTIES_IFACE)
- assert new_sig.args[0][0] in properties['Channels'], \
- (new_sig.args[0][0], properties['Channels'])
+ assertContains(sig.args[0][0], properties['Channels'])
conn.Disconnect()
q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])