telepathy-mission-control: account-manager/avatar test: assert about mock accounts service interactions
Simon McVittie
smcv at kemper.freedesktop.org
Wed Feb 13 06:23:50 PST 2013
Module: telepathy-mission-control
Branch: master
Commit: d6c23d2fc528b3cff92ec78c706a78cd561a2a9b
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=d6c23d2fc528b3cff92ec78c706a78cd561a2a9b
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Mon Sep 10 15:38:24 2012 +0100
account-manager/avatar test: assert about mock accounts service interactions
---
tests/twisted/account-manager/avatar.py | 60 +++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/tests/twisted/account-manager/avatar.py b/tests/twisted/account-manager/avatar.py
index af89c6f..daf9be7 100644
--- a/tests/twisted/account-manager/avatar.py
+++ b/tests/twisted/account-manager/avatar.py
@@ -50,6 +50,17 @@ def test(q, bus, mc):
interface=cs.ACCOUNT_IFACE_AVATAR,
args=[]),
EventPattern('dbus-return', method='Set'),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='DeferringSetAttribute',
+ args=[account.object_path, 'AvatarMime', 'image/jpeg']),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='CommittingOne',
+ args=[account.object_path]),
+ EventPattern('dbus-method-call',
+ interface=cs.TEST_DBUS_ACCOUNT_SERVICE_IFACE,
+ method='UpdateAttributes'),
)
assert account_props.Get(cs.ACCOUNT_IFACE_AVATAR, 'Avatar',
byte_arrays=True) == ('AAAA', 'image/jpeg')
@@ -78,7 +89,18 @@ def test(q, bus, mc):
handled=True),
EventPattern('dbus-signal', path=account.object_path,
interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged'),
- EventPattern('dbus-return', method='Set')
+ EventPattern('dbus-return', method='Set'),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='DeferringSetAttribute',
+ args=[account.object_path, 'AvatarMime', 'image/png']),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='CommittingOne',
+ args=[account.object_path]),
+ EventPattern('dbus-method-call',
+ interface=cs.TEST_DBUS_ACCOUNT_SERVICE_IFACE,
+ method='UpdateAttributes'),
)
assert account_props.Get(cs.ACCOUNT_IFACE_AVATAR, 'Avatar',
@@ -106,8 +128,21 @@ def test(q, bus, mc):
q.dbus_emit(conn.object_path, cs.CONN_IFACE_AVATARS,
'AvatarRetrieved', conn.self_handle, 'CCCC',
dbus.ByteArray('CCCC'), 'image/svg', signature='usays')
- q.expect('dbus-signal', path=account.object_path,
- interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged'),
+ q.expect_many(
+ EventPattern('dbus-signal', path=account.object_path,
+ interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged'),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='DeferringSetAttribute',
+ args=[account.object_path, 'avatar_token', 'CCCC']),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='CommittingOne',
+ args=[account.object_path]),
+ EventPattern('dbus-method-call',
+ interface=cs.TEST_DBUS_ACCOUNT_SERVICE_IFACE,
+ method='UpdateAttributes'),
+ )
assert account_props.Get(cs.ACCOUNT_IFACE_AVATAR, 'Avatar',
byte_arrays=True) == ('CCCC', 'image/svg')
@@ -119,8 +154,27 @@ def test(q, bus, mc):
q.dbus_emit(conn.object_path, cs.CONN_IFACE_AVATARS, 'AvatarUpdated',
conn.self_handle, '', signature='us')
q.expect('dbus-method-call', method='GetKnownAvatarTokens')
+ q.expect_many(
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='DeferringSetAttribute',
+ args=[account.object_path, 'avatar_token', '']),
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='DeferringSetAttribute',
+ args=[account.object_path, 'AvatarMime', '']),
+ )
q.expect('dbus-signal', path=account.object_path,
interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged')
+ q.expect_many(
+ EventPattern('dbus-signal',
+ interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
+ signal='CommittingOne',
+ args=[account.object_path]),
+ EventPattern('dbus-method-call',
+ interface=cs.TEST_DBUS_ACCOUNT_SERVICE_IFACE,
+ method='UpdateAttributes'),
+ )
assertEquals(account_props.Get(cs.ACCOUNT_IFACE_AVATAR, 'Avatar',
byte_arrays=False), ([], ''))
More information about the telepathy-commits
mailing list