telepathy-gabble: muc/chat-states: fix and uncomment commented chunk

Will Thompson wjt at kemper.freedesktop.org
Mon Mar 4 04:22:17 PST 2013


Module: telepathy-gabble
Branch: master
Commit: f843f499be4c16683a4a5b054a5bf747254b2050
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=f843f499be4c16683a4a5b054a5bf747254b2050

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Fri Feb 22 08:16:23 2013 +0000

muc/chat-states: fix and uncomment commented chunk

This didn't work as-is because the <presence type='unavailable'> had no
<x> child. Using make_muc_presence() does the job nicely.

---

 tests/twisted/muc/chat-states.py |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/twisted/muc/chat-states.py b/tests/twisted/muc/chat-states.py
index b5b3898..48e6678 100644
--- a/tests/twisted/muc/chat-states.py
+++ b/tests/twisted/muc/chat-states.py
@@ -4,7 +4,7 @@ wherein chat states in MUCs were misparsed, and MUC chat states in general.
 """
 
 from servicetest import assertEquals, assertLength
-from gabbletest import exec_test, elem
+from gabbletest import exec_test, elem, make_muc_presence
 from mucutil import join_muc_and_check
 import ns
 import constants as cs
@@ -71,21 +71,21 @@ def test(q, bus, conn, stream):
     assertEquals(cs.CHAT_STATE_PAUSED,
             states.get(bob, cs.CHAT_STATE_INACTIVE))
 
-#    # Bob leaves
-#    stream.send(
-#        elem('presence', from_=BOB, to='test at localhost/Resource',
-#                        type='unavailable'))
-
-#    e = q.expect('dbus-signal', signal='ChatStateChanged')
-#    contact, state = e.args
-#    assertEquals(bob, contact)
-#    assertEquals(cs.CHAT_STATE_GONE, state)
-
-#    states = chan.Properties.Get(cs.CHANNEL_IFACE_CHAT_STATE, 'ChatStates')
-#    assertEquals(cs.CHAT_STATE_INACTIVE,
-#            states.get(user, cs.CHAT_STATE_INACTIVE))
-#    # Bob no longer has any chat state at all
-#    assertEquals(None, states.get(bob, None))
+    # Bob leaves
+    presence = make_muc_presence('owner', 'none', MUC, 'bob')
+    presence['type'] = 'unavailable'
+    stream.send(presence)
+
+    e = q.expect('dbus-signal', signal='ChatStateChanged')
+    contact, state = e.args
+    assertEquals(bob, contact)
+    assertEquals(cs.CHAT_STATE_GONE, state)
+
+    states = chan.Properties.Get(cs.CHANNEL_IFACE_CHAT_STATE, 'ChatStates')
+    assertEquals(cs.CHAT_STATE_INACTIVE,
+            states.get(user, cs.CHAT_STATE_INACTIVE))
+    # Bob no longer has any chat state at all
+    assertEquals(None, states.get(bob, None))
 
     # Sending chat states:
 



More information about the telepathy-commits mailing list