telepathy-gabble: Regression test for 57521

Will Thompson wjt at kemper.freedesktop.org
Thu Dec 6 08:39:37 PST 2012


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

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Tue Nov 27 18:06:44 2012 +0000

Regression test for 57521

---

 tests/twisted/presence/invisible_xep_0126.py |   31 ++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/presence/invisible_xep_0126.py b/tests/twisted/presence/invisible_xep_0126.py
index a22fe46..a165140 100644
--- a/tests/twisted/presence/invisible_xep_0126.py
+++ b/tests/twisted/presence/invisible_xep_0126.py
@@ -49,6 +49,35 @@ def test_create_invisible_list(q, bus, conn, stream):
     assertContains("hidden",
         conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses"))
 
+def test_create_invisible_list_failed(q, bus, conn, stream):
+    conn.SimplePresence.SetPresence("away", "")
+
+    conn.Connect()
+
+    stream.handle_get_all_privacy_lists(q, bus, conn)
+
+    get_list = q.expect('stream-iq', query_ns=ns.PRIVACY, iq_type='get')
+    list_node = xpath.queryForNodes('//list', get_list.query)[0]
+    assertEquals('invisible', list_node['name'])
+
+    error = domish.Element((None, 'error'))
+    error['type'] = 'cancel'
+    error.addElement((ns.STANZA, 'item-not-found'))
+    send_error_reply (stream, get_list.stanza, error)
+
+    create_list = q.expect('stream-iq', query_ns=ns.PRIVACY, iq_type='set')
+    list_node = xpath.queryForNodes('//list', create_list.query)[0]
+    assertEquals('invisible', list_node['name'])
+    assertNotEquals([],
+        xpath.queryForNodes('/query/list/item/presence-out', create_list.query))
+    send_error_reply(stream, create_list.stanza)
+
+    q.expect('dbus-signal', signal='StatusChanged',
+        args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+
+    assertDoesNotContain("hidden",
+        conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses"))
+
 def test_invisible_on_connect_fail_no_list(q, bus, conn, stream):
     props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE)
     assertNotEquals({}, props['Statuses'])
@@ -316,6 +345,8 @@ if __name__ == '__main__':
               do_connect=False)
     exec_test(test_create_invisible_list, protocol=ManualPrivacyListStream,
               do_connect=False)
+    exec_test(test_create_invisible_list_failed, protocol=ManualPrivacyListStream,
+              do_connect=False)
     exec_test(test_invisible_on_connect_fail_no_list,
               protocol=ManualPrivacyListStream, do_connect=False)
     exec_test(test_invisible_on_connect_fail_invalid_list,



More information about the telepathy-commits mailing list