[telepathy-mission-control/master] test/twisted: add support for simulating connections with Capabilities
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Jul 27 06:24:38 PDT 2009
---
test/twisted/constants.py | 1 +
test/twisted/mctest.py | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/test/twisted/constants.py b/test/twisted/constants.py
index cd83907..d666c51 100644
--- a/test/twisted/constants.py
+++ b/test/twisted/constants.py
@@ -57,6 +57,7 @@ INTERFACES = CHANNEL + '.Interfaces'
CONN = tp_name_prefix + ".Connection"
CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing'
CONN_IFACE_AVATARS = CONN + '.Interface.Avatars'
+CONN_IFACE_CAPS = CONN + '.Interface.Capabilities'
CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
CONN_IFACE_CONTACT_CAPA = CONN + '.Interface.ContactCapabilities.DRAFT'
CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
diff --git a/test/twisted/mctest.py b/test/twisted/mctest.py
index 9df478a..5df1221 100644
--- a/test/twisted/mctest.py
+++ b/test/twisted/mctest.py
@@ -159,7 +159,7 @@ class SimulatedConnection(object):
def __init__(self, q, bus, cmname, protocol, account_part, self_ident,
implement_get_interfaces=True, has_requests=True,
has_presence=False, has_aliasing=False, has_avatars=False,
- avatars_persist=True):
+ avatars_persist=True, has_old_caps=False):
self.q = q
self.bus = bus
@@ -181,6 +181,7 @@ class SimulatedConnection(object):
self.has_aliasing = has_aliasing
self.has_avatars = has_avatars
self.avatars_persist = avatars_persist
+ self.has_old_caps = has_old_caps
if self.avatars_persist:
self.avatar = dbus.Struct((dbus.ByteArray('my old avatar'),
@@ -357,6 +358,9 @@ class SimulatedConnection(object):
if self.has_presence:
interfaces.append(cs.CONN_IFACE_SIMPLE_PRESENCE)
+ if self.has_old_caps:
+ interfaces.append(cs.CONN_IFACE_CAPS)
+
self.q.dbus_return(e.message, interfaces, signature='as')
def Connect(self, e):
@@ -735,7 +739,7 @@ def create_fakecm_account(q, bus, mc, params):
def enable_fakecm_account(q, bus, mc, account, expected_params,
has_requests=True, has_presence=False, has_aliasing=False,
- has_avatars=False, avatars_persist=True,
+ has_avatars=False, avatars_persist=True, has_old_caps=False,
requested_presence=(2, 'available', ''),
expect_after_connect=[]):
# Enable the account
@@ -761,7 +765,7 @@ def enable_fakecm_account(q, bus, mc, account, expected_params,
conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol', '_',
'myself', has_requests=has_requests, has_presence=has_presence,
has_aliasing=has_aliasing, has_avatars=has_avatars,
- avatars_persist=avatars_persist)
+ avatars_persist=avatars_persist, has_old_caps=has_old_caps)
q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
--
1.5.6.5
More information about the telepathy-commits
mailing list