summaryrefslogtreecommitdiff
path: root/tests/twisted/text
diff options
context:
space:
mode:
Diffstat (limited to 'tests/twisted/text')
-rw-r--r--tests/twisted/text/destroy.py9
-rw-r--r--tests/twisted/text/ensure.py31
-rw-r--r--tests/twisted/text/initiate-requestotron.py15
-rw-r--r--tests/twisted/text/initiate.py4
-rw-r--r--tests/twisted/text/respawn.py13
-rw-r--r--tests/twisted/text/test-text-delayed.py4
-rw-r--r--tests/twisted/text/test-text-no-body.py4
-rw-r--r--tests/twisted/text/test-text.py4
8 files changed, 35 insertions, 49 deletions
diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py
index b05037a56..64cca39d1 100644
--- a/tests/twisted/text/destroy.py
+++ b/tests/twisted/text/destroy.py
@@ -24,18 +24,15 @@ def test(q, bus, conn, stream):
ret, new_sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text')
chan_iface = dbus.Interface(text_chan, cs.CHANNEL)
destroyable_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_DESTROYABLE)
- 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]
- emitted_props = new_sig.args[0][0][1]
+ assert new_sig.args[0] == ret.value[0]
+ emitted_props = new_sig.args[1]
assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
assert emitted_props[cs.TARGET_HANDLE] == foo_handle
diff --git a/tests/twisted/text/ensure.py b/tests/twisted/text/ensure.py
index fcef90a69..7149940b8 100644
--- a/tests/twisted/text/ensure.py
+++ b/tests/twisted/text/ensure.py
@@ -5,7 +5,7 @@ Test text channel initiated by me, using Requests.EnsureChannel
import dbus
from gabbletest import exec_test
-from servicetest import call_async, EventPattern
+from servicetest import call_async, EventPattern, assertContains
import constants as cs
def test(q, bus, conn, stream):
@@ -17,6 +17,9 @@ def test(q, bus, conn, stream):
properties = conn.GetAll(
cs.CONN_IFACE_REQUESTS, dbus_interface=cs.PROPERTIES_IFACE)
assert properties.get('Channels') == [], properties['Channels']
+
+ properties = conn.GetAll(
+ cs.CONN, dbus_interface=cs.PROPERTIES_IFACE)
assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
},
@@ -38,7 +41,7 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle):
ret, new_sig = q.expect_many(
EventPattern('dbus-return', method='EnsureChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
assert len(ret.value) == 3
@@ -50,18 +53,13 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle):
check_props(emitted_props, self_handle, handle, jid)
- 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] == path
- assert new_sig.args[0][0][1] == emitted_props
+ assert new_sig.args[0] == path
+ assert new_sig.args[1] == emitted_props
properties = conn.GetAll(
cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
- assert new_sig.args[0][0] in properties['Channels'], \
- (new_sig.args[0][0], properties['Channels'])
-
+ assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels'])
# Now try Ensuring a channel which already exists
call_async(q, conn.Requests, 'EnsureChannel', request_props(handle))
@@ -87,7 +85,7 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
ret, new_sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
assert len(ret.value) == 2
@@ -95,18 +93,13 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
check_props(emitted_props, self_handle, handle, jid)
- 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] == path
- assert new_sig.args[0][0][1] == emitted_props
+ assert new_sig.args[0] == path
+ assert new_sig.args[1] == emitted_props
properties = conn.GetAll(
cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
- assert new_sig.args[0][0] in properties['Channels'], \
- (new_sig.args[0][0], properties['Channels'])
-
+ assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels'])
# Now try Ensuring that same channel.
call_async(q, conn.Requests, 'EnsureChannel', request_props(handle))
diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py
index c969eaac1..729486b47 100644
--- a/tests/twisted/text/initiate-requestotron.py
+++ b/tests/twisted/text/initiate-requestotron.py
@@ -18,6 +18,9 @@ def test(q, bus, conn, stream):
properties = conn.GetAll(
cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
assert properties.get('Channels') == [], properties['Channels']
+
+ properties = conn.GetAll(
+ cs.CONN, dbus_interface=dbus.PROPERTIES_IFACE)
assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
},
@@ -33,7 +36,7 @@ def test(q, bus, conn, stream):
ret, new_sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
assert len(ret.value) == 2
@@ -50,17 +53,13 @@ def test(q, bus, conn, stream):
assertEquals(cs.DELIVERY_REPORTING_SUPPORT_FLAGS_RECEIVE_FAILURES,
emitted_props[cs.DELIVERY_REPORTING_SUPPORT])
- 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]
+ assert new_sig.args[0] == ret.value[0]
+ assert new_sig.args[1] == ret.value[1]
properties = conn.GetAll(
cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
- assert new_sig.args[0][0] in properties['Channels'], \
- (new_sig.args[0][0], properties['Channels'])
+ assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels'])
if __name__ == '__main__':
exec_test(test)
diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py
index 778dd6a58..92594c6de 100644
--- a/tests/twisted/text/initiate.py
+++ b/tests/twisted/text/initiate.py
@@ -23,12 +23,12 @@ def test(q, bus, conn, stream):
ret, sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text')
- path, props = sig.args[0][0]
+ path, props = sig.args
assertEquals(ret.value[0], path)
assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE])
# check that handle type == contact handle
diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py
index 6998b2b7c..8ca081699 100644
--- a/tests/twisted/text/respawn.py
+++ b/tests/twisted/text/respawn.py
@@ -23,17 +23,14 @@ def test(q, bus, conn, stream):
ret, new_sig = q.expect_many(
EventPattern('dbus-return', method='CreateChannel'),
- EventPattern('dbus-signal', signal='NewChannels'),
+ EventPattern('dbus-signal', signal='NewChannel'),
)
text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text')
chan_iface = dbus.Interface(text_chan, cs.CHANNEL)
- 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]
- emitted_props = new_sig.args[0][0][1]
+ assert new_sig.args[0] == ret.value[0]
+ emitted_props = new_sig.args[1]
assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
assert emitted_props[cs.TARGET_HANDLE] == foo_handle
@@ -92,8 +89,8 @@ def test(q, bus, conn, stream):
assert new.args[0] == text_chan.object_path,\
(new.args[0], text_chan.object_path)
- event = q.expect('dbus-signal', signal='NewChannels')
- path, props = event.args[0][0]
+ event = q.expect('dbus-signal', signal='NewChannel')
+ path, props = event.args
assertEquals(text_chan.object_path, path)
assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE])
assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE])
diff --git a/tests/twisted/text/test-text-delayed.py b/tests/twisted/text/test-text-delayed.py
index 605b2c148..480d40271 100644
--- a/tests/twisted/text/test-text-delayed.py
+++ b/tests/twisted/text/test-text-delayed.py
@@ -23,8 +23,8 @@ def test(q, bus, conn, stream):
stream.send(m)
- event = q.expect('dbus-signal', signal='NewChannels')
- path, props = event.args[0][0]
+ event = q.expect('dbus-signal', signal='NewChannel')
+ path, props = event.args
assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE])
assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE])
jid = conn.inspect_contact_sync(props[cs.TARGET_HANDLE])
diff --git a/tests/twisted/text/test-text-no-body.py b/tests/twisted/text/test-text-no-body.py
index 34e54b7bb..ec70b77b4 100644
--- a/tests/twisted/text/test-text-no-body.py
+++ b/tests/twisted/text/test-text-no-body.py
@@ -28,8 +28,8 @@ def test(q, bus, conn, stream):
stream.send(m)
# first message should be from Bob, not Alice
- event = q.expect('dbus-signal', signal='NewChannels')
- path, props = event.args[0][0]
+ event = q.expect('dbus-signal', signal='NewChannel')
+ path, props = event.args
assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE])
jid = conn.inspect_contact_sync(props[cs.TARGET_HANDLE])
assertEquals('bob@foo.com', jid)
diff --git a/tests/twisted/text/test-text.py b/tests/twisted/text/test-text.py
index ff7bb1678..fc3c42b80 100644
--- a/tests/twisted/text/test-text.py
+++ b/tests/twisted/text/test-text.py
@@ -23,8 +23,8 @@ def test(q, bus, conn, stream):
m.addElement('body', content='hello')
stream.send(m)
- event = q.expect('dbus-signal', signal='NewChannels')
- path, props = event.args[0][0]
+ event = q.expect('dbus-signal', signal='NewChannel')
+ path, props = event.args
text_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'Text')
assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE])
assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE])