[telepathy-mission-control/master] account-manager/auto-connect.py: test setting an avatar that was changed while offline
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Jun 2 11:46:11 PDT 2009
---
test/twisted/account-manager/auto-connect.py | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/test/twisted/account-manager/auto-connect.py b/test/twisted/account-manager/auto-connect.py
index 7e20dbd..6911df6 100644
--- a/test/twisted/account-manager/auto-connect.py
+++ b/test/twisted/account-manager/auto-connect.py
@@ -14,13 +14,15 @@ import constants as cs
cm_name_ref = dbus.service.BusName(
cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=dbus.SessionBus())
+account_id = 'fakecm/fakeprotocol/jc_2edenton_40unatco_2eint'
+
def preseed():
accounts_dir = os.environ['MC_ACCOUNT_DIR']
accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
accounts_cfg.write("""# Telepathy accounts
-[fakecm/fakeprotocol/jc_2edenton_40unatco_2eint]
+[%s]
manager=fakecm
protocol=fakeprotocol
DisplayName=Work account
@@ -33,9 +35,15 @@ AutomaticPresenceType=2
AutomaticPresenceStatus=available
AutomaticPresenceMessage=My vision is augmented
Nickname=JC
-""")
+AvatarMime=image/jpeg
+""" % account_id)
accounts_cfg.close()
+ os.makedirs(accounts_dir + '/' + account_id)
+ avatar_bin = open(accounts_dir + '/' + account_id + '/avatar.bin', 'w')
+ avatar_bin.write('Deus Ex')
+ avatar_bin.close()
+
account_connections_file = open(accounts_dir + '/.mc_connections', 'w')
account_connections_file.write("")
account_connections_file.close()
@@ -54,12 +62,11 @@ def test(q, bus, mc):
handled=False)
conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol', '_',
- 'myself', has_presence=True, has_aliasing=True)
+ 'myself', has_presence=True, has_aliasing=True, has_avatars=True)
q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
- account_path = (cs.tp_path_prefix +
- '/Account/fakecm/fakeprotocol/jc_2edenton_40unatco_2eint')
+ account_path = (cs.tp_path_prefix + '/Account/' + account_id)
e, _ = q.expect_many(
EventPattern('dbus-signal', signal='AccountPropertyChanged',
@@ -74,9 +81,10 @@ def test(q, bus, mc):
assert e.args[0]['ConnectionStatusReason'] == \
cs.CONN_STATUS_REASON_REQUESTED
+ print "becoming connected"
conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CONN_STATUS_REASON_NONE)
- set_aliases, set_presence, e = q.expect_many(
+ set_aliases, set_presence, set_avatar, e = q.expect_many(
EventPattern('dbus-method-call',
interface=cs.CONN_IFACE_ALIASING, method='SetAliases',
args=[{ conn.self_handle: 'JC' }],
@@ -84,6 +92,10 @@ def test(q, bus, mc):
EventPattern('dbus-method-call', path=conn.object_path,
interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
handled=True),
+ EventPattern('dbus-method-call',
+ interface=cs.CONN_IFACE_AVATARS, method='SetAvatar',
+ args=['Deus Ex', 'image/jpeg'],
+ handled=True),
EventPattern('dbus-signal', signal='AccountPropertyChanged',
path=account_path, interface=cs.ACCOUNT,
predicate=lambda e: 'ConnectionStatus' in e.args[0]),
--
1.5.6.5
More information about the telepathy-commits
mailing list