[Telepathy-commits] [telepathy-gabble/master] olpc-activity-search.py: factor out close view code
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:33 PDT 2008
20080703125407-7fe3f-cdb08ea272965ab7e92f52c290ab5c83765b0235.gz
---
tests/twisted/olpc/olpc-activity-search.py | 33 ++++++++++-----------------
1 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index e52b101..02cc178 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -33,6 +33,15 @@ def check_view(view, conn, activities, buddies):
handles = view.GetBuddies()
assert sorted(conn.InspectHandles(1, handles)) == sorted(buddies)
+def close_view(q, view_iface, id):
+ call_async(q, view_iface, 'Close')
+ event, _ = q.expect_many(
+ EventPattern('stream-message', to='gadget.localhost'),
+ EventPattern('dbus-return', method='Close'))
+ close = xpath.queryForNodes('/message/close', event.stanza)
+ assert len(close) == 1
+ assert close[0]['id'] == id
+
def test(q, bus, conn, stream):
conn.Connect()
@@ -442,31 +451,13 @@ def test(q, bus, conn, stream):
['fernand at localhost', 'jean at localhost'])
# close view 0
- call_async(q, view0_iface, 'Close')
- event, _ = q.expect_many(
- EventPattern('stream-message', to='gadget.localhost'),
- EventPattern('dbus-return', method='Close'))
- close = xpath.queryForNodes('/message/close', event.stanza)
- assert len(close) == 1
- assert close[0]['id'] == '0'
+ close_view(q, view0_iface, '0')
# close view 1
- call_async(q, view1_iface, 'Close')
- event, _ = q.expect_many(
- EventPattern('stream-message', to='gadget.localhost'),
- EventPattern('dbus-return', method='Close'))
- close = xpath.queryForNodes('/message/close', event.stanza)
- assert len(close) == 1
- assert close[0]['id'] == '1'
+ close_view(q, view1_iface, '1')
# close view 2
- call_async(q, view2_iface, 'Close')
- event, _ = q.expect_many(
- EventPattern('stream-message', to='gadget.localhost'),
- EventPattern('dbus-return', method='Close'))
- close = xpath.queryForNodes('/message/close', event.stanza)
- assert len(close) == 1
- assert close[0]['id'] == '2'
+ close_view(q, view2_iface, '2')
if __name__ == '__main__':
exec_test(test)
--
1.5.6.5
More information about the Telepathy-commits
mailing list