From 781d7dfafbb2afddd1808194ea0a18cdf81d58be Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 3 Oct 2013 16:00:52 +0100 Subject: [PATCH 22/22] SimulatedChannel: fill in extra immutable properties Not all of our regression tests fill in all the necessary immutable properties for a modern TpChannel to prepare; some of them cut corners. Fill in the gaps. --- tests/twisted/mctest.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index 3704eef..7e0350b 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -608,9 +608,24 @@ class SimulatedChannel(object): self.q = conn.q self.bus = conn.bus self.object_path = conn.object_path + ('/_%x' % id(self)) - self.immutable = immutable + self.immutable = immutable.copy() + + if self.immutable[cs.TARGET_HANDLE_TYPE] != cs.HT_NONE: + if (cs.TARGET_ID in self.immutable) != ( + cs.TARGET_HANDLE in self.immutable): + if cs.TARGET_ID in self.immutable: + self.immutable[cs.TARGET_HANDLE] = conn.ensure_handle( + self.immutable[cs.TARGET_HANDLE_TYPE], + self.immutable[cs.TARGET_ID]) + else: + self.immutable[cs.TARGET_ID] = conn.inspect_handles( + [self.immutable[cs.TARGET_HANDLE]])[0] + + if cs.REQUESTED not in self.immutable: + self.immutable[cs.REQUESTED] = False + self.properties = dbus.Dictionary({}, signature='sv') - self.properties.update(immutable) + self.properties.update(self.immutable) self.properties.update(mutable) self.q.add_dbus_method_impl(self.GetAll, -- 1.8.4.rc3