diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-10-09 13:04:12 -0400 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-10-11 17:55:05 -0400 |
commit | 93fcbfb8bbcabf254cf0e50bbb7f6592cc44e8ca (patch) | |
tree | 785aa0c1f8b32f059e0841bef2a0181619fef8d7 | |
parent | efa15d6ca605f205317da7b986d0dac606a0cc57 (diff) |
use send_msg_sync() in all tests
-rw-r--r-- | tests/twisted/muc/chat-states.py | 2 | ||||
-rw-r--r-- | tests/twisted/muc/test-muc.py | 2 | ||||
-rw-r--r-- | tests/twisted/text/destroy.py | 7 | ||||
-rw-r--r-- | tests/twisted/text/initiate.py | 6 | ||||
-rw-r--r-- | tests/twisted/text/respawn.py | 7 | ||||
-rw-r--r-- | tests/twisted/text/send-to-correct-resource.py | 8 | ||||
-rw-r--r-- | tests/twisted/text/test-chat-state.py | 10 |
7 files changed, 20 insertions, 22 deletions
diff --git a/tests/twisted/muc/chat-states.py b/tests/twisted/muc/chat-states.py index 87a008d7b..5aaee085c 100644 --- a/tests/twisted/muc/chat-states.py +++ b/tests/twisted/muc/chat-states.py @@ -108,7 +108,7 @@ def test(q, bus, conn, stream): # XEP 0085: # every content message SHOULD contain an <active/> notification. - chan.Text.Send(0, 'hi.') + chan.send_msg_sync('hi.') stream_message = q.expect('stream-message') stanza = stream_message.stanza diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py index c469e8eed..3a040ef2f 100644 --- a/tests/twisted/muc/test-muc.py +++ b/tests/twisted/muc/test-muc.py @@ -199,7 +199,7 @@ def test(q, bus, conn, stream): # Send a normal message using the Channel.Type.Text API - chan.Text.Send(0, 'goodbye') + chan.send_msg_sync('goodbye') event, sent, message_sent = q.expect_many( EventPattern('stream-message'), diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py index 9b1f3d657..99c65c9b9 100644 --- a/tests/twisted/text/destroy.py +++ b/tests/twisted/text/destroy.py @@ -8,7 +8,7 @@ import dbus from twisted.words.xish import domish from gabbletest import exec_test -from servicetest import call_async, EventPattern +from servicetest import call_async, EventPattern, wrap_channel import constants as cs def test(q, bus, conn, stream): @@ -27,9 +27,8 @@ def test(q, bus, conn, stream): EventPattern('dbus-signal', signal='NewChannels'), ) - text_chan = bus.get_object(conn.bus_name, ret.value[0]) + text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') chan_iface = dbus.Interface(text_chan, cs.CHANNEL) - text_iface = dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT) destroyable_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_DESTROYABLE) assert len(new_sig.args) == 1 @@ -54,7 +53,7 @@ def test(q, bus, conn, stream): assert channel_props['InitiatorID'] == 'test@localhost',\ channel_props['InitiatorID'] - text_iface.Send(0, 'hey') + text_chan.send_msg_sync('hey') event = q.expect('stream-message') diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py index a237fc663..ef946e28d 100644 --- a/tests/twisted/text/initiate.py +++ b/tests/twisted/text/initiate.py @@ -7,7 +7,7 @@ import dbus from twisted.words.xish import domish from gabbletest import exec_test -from servicetest import call_async, EventPattern, assertEquals +from servicetest import call_async, EventPattern, assertEquals, wrap_channel import constants as cs def test(q, bus, conn, stream): @@ -26,7 +26,7 @@ def test(q, bus, conn, stream): EventPattern('dbus-signal', signal='NewChannels'), ) - text_chan = bus.get_object(conn.bus_name, ret.value[0]) + text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') path, props = sig.args[0][0] assertEquals(ret.value[0], path) @@ -56,7 +56,7 @@ def test(q, bus, conn, stream): assert channel_props['InitiatorID'] == 'test@localhost',\ channel_props['InitiatorID'] - dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT).Send(0, 'hey') + text_chan.send_msg_sync('hey') event = q.expect('stream-message') diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py index 0abc30fb1..e9e2239de 100644 --- a/tests/twisted/text/respawn.py +++ b/tests/twisted/text/respawn.py @@ -7,7 +7,7 @@ import dbus from twisted.words.xish import domish from gabbletest import exec_test -from servicetest import call_async, EventPattern, assertEquals +from servicetest import call_async, EventPattern, assertEquals, wrap_channel import constants as cs def test(q, bus, conn, stream): @@ -26,9 +26,8 @@ def test(q, bus, conn, stream): EventPattern('dbus-signal', signal='NewChannels'), ) - text_chan = bus.get_object(conn.bus_name, ret.value[0]) + text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') chan_iface = dbus.Interface(text_chan, cs.CHANNEL) - text_iface = dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT) assert len(new_sig.args) == 1 assert len(new_sig.args[0]) == 1 # one channel @@ -53,7 +52,7 @@ def test(q, bus, conn, stream): assert channel_props['InitiatorID'] == 'test@localhost',\ channel_props['InitiatorID'] - text_iface.Send(0, 'hey') + text_chan.send_msg_sync('hey') event = q.expect('stream-message') diff --git a/tests/twisted/text/send-to-correct-resource.py b/tests/twisted/text/send-to-correct-resource.py index f29fa51a1..67b470f46 100644 --- a/tests/twisted/text/send-to-correct-resource.py +++ b/tests/twisted/text/send-to-correct-resource.py @@ -24,7 +24,7 @@ def test(q, bus, conn, stream): chan = wrap_channel(bus.get_object(conn.bus_name, path), 'Text') # When we start a conversation, Gabble should send to the bare JID. - chan.Text.Send(0, 'hey, you around?') + chan.send_msg_sync('hey, you around?') q.expect('stream-message', to=contact) # A particular resource replies. @@ -38,7 +38,7 @@ def test(q, bus, conn, stream): # Now that we got a reply from a particular resource, Gabble should reply # there. - chan.Text.Send(0, 'nice') + chan.send_msg_sync('nice') q.expect('stream-message', to=contact_a) # Now another resource messages us @@ -51,7 +51,7 @@ def test(q, bus, conn, stream): q.expect('dbus-signal', signal='Received') # Gabble should have updated the resource it's sending to. - chan.Text.Send(0, "don't get sand in the keyboard") + chan.send_msg_sync("don't get sand in the keyboard") e = q.expect('stream-message', to=contact_b) # But actually that resource has gone offline: @@ -68,7 +68,7 @@ def test(q, bus, conn, stream): q.expect('dbus-signal', signal='SendError') # So as a result, Gabble should send the next message to the bare JID. - chan.Text.Send(0, "... i guess my warning was too late") + chan.send_msg_sync("... i guess my warning was too late") q.expect('stream-message', to=contact) if __name__ == '__main__': diff --git a/tests/twisted/text/test-chat-state.py b/tests/twisted/text/test-chat-state.py index 64bd44f53..85ba95e38 100644 --- a/tests/twisted/text/test-chat-state.py +++ b/tests/twisted/text/test-chat-state.py @@ -141,7 +141,7 @@ def test(q, bus, conn, stream): # XEP 0085: # every content message SHOULD contain an <active/> notification. - chan.Text.Send(0, 'hi.') + chan.send_msg_sync('hi.') stream_message = q.expect('stream-message') elem = stream_message.stanza @@ -234,7 +234,7 @@ def test(q, bus, conn, stream): assertEquals(cs.CHAT_STATE_COMPOSING, state) assertEquals(self_handle, handle) - chan.Text.Send(0, 'very convincing') + chan.send_msg_sync('very convincing') stream_message = q.expect('stream-message', to=full_jid) check_state_notification(stream_message.stanza, 'active', allow_body=True) @@ -267,7 +267,7 @@ def test(q, bus, conn, stream): q.unforbid_events([e]) # When we send a message, say we're active. - chan.Text.Send(0, 'is anyone there?') + chan.send_msg_sync('is anyone there?') stream_message = q.expect('stream-message', to=jid) check_state_notification(stream_message.stanza, 'active', allow_body=True) @@ -350,7 +350,7 @@ def test(q, bus, conn, stream): q.unforbid_events([e]) # When we send a message, say we're active. - chan.Text.Send(0, '#n900 #maemo #zomg #woo #yay http://bit.ly/n900') + chan.send_msg_sync('#n900 #maemo #zomg #woo #yay http://bit.ly/n900') stream_message = q.expect('stream-message', to=jid) check_state_notification(stream_message.stanza, 'active', allow_body=True) @@ -367,7 +367,7 @@ def test(q, bus, conn, stream): sync_stream(q, stream) q.unforbid_events([e]) - chan.Text.Send(0, '@stephenfry simmer down') + chan.send_msg_sync('@stephenfry simmer down') message = q.expect('stream-message') states = [x for x in message.stanza.elements() if x.uri == ns.CHAT_STATES] assertLength(0, states) |