[Telepathy-commits] [telepathy-gabble/master] Improve tests
Pierre-Luc Beaudoin
pierre-luc.beaudoin at collabora.co.uk
Sun Feb 1 05:23:56 PST 2009
---
tests/twisted/test-location.py | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py
index 09eff4a..959f0c6 100644
--- a/tests/twisted/test-location.py
+++ b/tests/twisted/test-location.py
@@ -1,5 +1,7 @@
from gabbletest import exec_test, make_result_iq
-from servicetest import call_async
+from servicetest import call_async, EventPattern
+
+from twisted.words.xish import domish, xpath
location_iface = \
'org.freedesktop.Telepathy.Connection.Interface.Location.DRAFT'
@@ -14,12 +16,12 @@ def test(q, bus, conn, stream):
q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
# check location properties
- properties = conn.GetAll(
- location_iface,
- dbus_interface='org.freedesktop.DBus.Properties')
+ #properties = conn.GetAll(
+ # location_iface,
+ # dbus_interface='org.freedesktop.DBus.Properties')
- assert properties.get('LocationAccessControlTypes') is not None
- assert properties.get('LocationAccessControl') is not None
+ #assert properties.get('LocationAccessControlTypes') is not None
+ #assert properties.get('LocationAccessControl') is not None
# discard activities request
q.expect('stream-iq', iq_type='set',
@@ -28,8 +30,8 @@ def test(q, bus, conn, stream):
conn.Location.SetLocation({
'lat': dbus.Double(0.0, variant_level=1), 'lon': 0.0})
- event = q.expect('stream-iq', iq_type='set',
- query_ns='http://jabber.org/protocol/pubsub')
+ event = q.expect('stream-iq', predicate=lambda x:
+ xpath.queryForNodes("/iq/pubsub/publish/item/geoloc", x.stanza))
handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
call_async(q, conn.Location, 'GetLocations', [handle])
@@ -44,6 +46,14 @@ def test(q, bus, conn, stream):
geoloc.addElement('lon', content='5.678')
stream.send(result)
+ q.expect_many(
+ EventPattern('dbus-return', method='GetLocations'),
+ EventPattern('dbus-signal', signal='LocationUpdated'))
+
+ # Get location again, only GetLocation should get fired
+ handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
+ call_async(q, conn.Location, 'GetLocations', [handle])
+
q.expect('dbus-return', method='GetLocations')
conn.Disconnect()
--
1.5.6.5
More information about the Telepathy-commits
mailing list