summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-17 16:19:23 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-17 17:49:46 +0100
commit8442417b414d4144392f1d11cd2a2454bedd1826 (patch)
tree4a1fb4bdab01bff2c79d3bcaf519ca85732b2976
parentd83535cc0a9f2d0b75ecba17a97db51cb49affb0 (diff)
downloadtelepathy-haze-8442417b414d4144392f1d11cd2a2454bedd1826.tar.gz
Test unknown presences
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69474 Reviewed-by: Xavier Claessens <xavier.claessens@collabora.co.uk>
-rw-r--r--tests/twisted/constants.py1
-rw-r--r--tests/twisted/presence/presence.py13
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@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@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@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])