diff options
-rw-r--r-- | tests/twisted/text/test-chat-state.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/twisted/text/test-chat-state.py b/tests/twisted/text/test-chat-state.py index d1acd6dd2..247b35cee 100644 --- a/tests/twisted/text/test-chat-state.py +++ b/tests/twisted/text/test-chat-state.py @@ -6,7 +6,8 @@ channels. from twisted.words.xish import domish -from servicetest import call_async, assertEquals, wrap_channel, EventPattern +from servicetest import (call_async, assertEquals, wrap_channel, EventPattern, + sync_dbus) from gabbletest import exec_test, make_result_iq, sync_stream, make_presence import constants as cs import ns @@ -87,6 +88,23 @@ def test(q, bus, conn, stream): assertEquals(foo_handle, handle) assertEquals(cs.CHAT_STATE_ACTIVE, state) + # Assert that a redundant chat-state change doesn't emit a signal + + forbidden = [EventPattern('dbus-signal', signal='ChatStateChanged', + args=[foo_handle, cs.CHAT_STATE_ACTIVE])] + q.forbid_events(forbidden) + + m = domish.Element((None, 'message')) + m['from'] = 'foo@bar.com/Foo' + m['type'] = 'chat' + m.addElement((ns.CHAT_STATES, 'active')) + m.addElement('body', content='hello') + stream.send(m) + + sync_dbus(bus, q, conn) + + q.unforbid_events(forbidden) + # Sending chat states: # Composing... |