telepathy-gabble: Add regression test coverage for the presence of a non-roster contact
Simon McVittie
smcv at kemper.freedesktop.org
Tue Sep 17 09:48:20 PDT 2013
Module: telepathy-gabble
Branch: master
Commit: a9ab5ca2cd21d39e8820eccad48ec52bbd073bbb
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=a9ab5ca2cd21d39e8820eccad48ec52bbd073bbb
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Tue Sep 17 16:19:07 2013 +0100
Add regression test coverage for the presence of a non-roster contact
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69474
---
tests/twisted/constants.py | 1 +
tests/twisted/presence/presence.py | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index c194ee3..3f6cec0 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -186,6 +186,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 4997469..2f1439b 100644
--- a/tests/twisted/presence/presence.py
+++ b/tests/twisted/presence/presence.py
@@ -1,13 +1,11 @@
"""
A simple smoke-test for C.I.SimplePresence
-
-FIXME: test C.I.Presence too
"""
from twisted.words.xish import domish
from gabbletest import exec_test, make_presence
-from servicetest import EventPattern
+from servicetest import EventPattern, assertEquals
import ns
import constants as cs
@@ -31,9 +29,18 @@ def test(q, bus, conn, stream):
stream.send(make_presence(
'amy at foo.com', show='chat', status='I may have been drinking'))
- q.expect('dbus-signal', signal='PresencesChanged',
+ e = q.expect('dbus-signal', signal='PresencesChanged',
args=[{amy_handle:
(cs.PRESENCE_AVAILABLE, 'chat', 'I may have been drinking')}])
+ amy_handle, asv = conn.Contacts.GetContactByID('amy at foo.com',
+ [cs.CONN_IFACE_SIMPLE_PRESENCE])
+ assertEquals(e.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))
+
if __name__ == '__main__':
exec_test(test)
More information about the telepathy-commits
mailing list