[telepathy-haze-0.8] telepathy-haze: Test unknown presences

Simon McVittie smcv at kemper.freedesktop.org
Tue Sep 17 09:50:32 PDT 2013


Module: telepathy-haze
Branch: telepathy-haze-0.8
Commit: 8442417b414d4144392f1d11cd2a2454bedd1826
URL:    http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=8442417b414d4144392f1d11cd2a2454bedd1826

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Sep 17 16:19:23 2013 +0100

Test unknown presences

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69474
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 tests/twisted/constants.py         |    1 +
 tests/twisted/presence/presence.py |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index d541c75..37d6d52 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -195,6 +195,7 @@ CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking'
 CONN_IFACE_ADDRESSING = CONN + '.Interface.Addressing1'
 
 ATTR_CONTACT_CAPABILITIES = CONN_IFACE_CONTACT_CAPS + '/capabilities'
+ATTR_PRESENCE = CONN_IFACE_SIMPLE_PRESENCE + '/presence'
 
 STREAM_HANDLER = 'org.freedesktop.Telepathy.Media.StreamHandler'
 
diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py
index a3c5854..e35616e 100644
--- a/tests/twisted/presence/presence.py
+++ b/tests/twisted/presence/presence.py
@@ -1,7 +1,5 @@
 """
 A simple smoke-test for C.I.SimplePresence
-
-FIXME: test C.I.Presence too
 """
 
 import dbus
@@ -9,7 +7,9 @@ import dbus
 from twisted.words.xish import domish, xpath
 from twisted.words.protocols.jabber.client import IQ
 
+from servicetest import assertEquals
 from hazetest import exec_test
+import constants as cs
 
 def test(q, bus, conn, stream):
     amy_handle = conn.RequestHandles(1, ['amy at foo.com'])[0]
@@ -48,6 +48,15 @@ def test(q, bus, conn, stream):
     # produces.
     assert event.args[0] == { amy_handle: (2, 'available', 'I may have been drinking') }
 
+    amy_handle, asv = conn.Contacts.GetContactByID('amy at foo.com',
+            [cs.CONN_IFACE_SIMPLE_PRESENCE])
+    assertEquals(event.args[0][amy_handle], asv.get(cs.ATTR_PRESENCE))
+
+    bob_handle, asv = conn.Contacts.GetContactByID('bob at foo.com',
+            [cs.CONN_IFACE_SIMPLE_PRESENCE])
+    assertEquals((cs.PRESENCE_UNKNOWN, 'unknown', ''),
+            asv.get(cs.ATTR_PRESENCE))
+
     conn.Disconnect()
     q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
 



More information about the telepathy-commits mailing list