diff options
author | George Kiagiadakis <gkiagia@tolabaki.gr> | 2016-08-15 11:37:24 +0300 |
---|---|---|
committer | George Kiagiadakis <gkiagia@tolabaki.gr> | 2016-09-01 21:07:15 +0300 |
commit | 78d8c53b930323455bb7c4031903f46717b8a174 (patch) | |
tree | 6ee153d86e15732b679c1cbd77f186fa7a33be49 | |
parent | c5589bdc4ded0382adf6ba9ffc5c27f8a6e0568d (diff) | |
download | telepathy-mission-control-78d8c53b930323455bb7c4031903f46717b8a174.tar.gz |
tests: make tests work again when NM support is enabled
Apparently the nm library also tries to access the /.../Settings
object of NM, which was not available in our fake NM implementation.
This commit implements the basic properties of the Settings object,
which allows the tests to continue past this point.
https://bugs.freedesktop.org/show_bug.cgi?id=96917
-rw-r--r-- | tests/twisted/fakeconnectivity.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/twisted/fakeconnectivity.py b/tests/twisted/fakeconnectivity.py index 02d577fb..846dd767 100644 --- a/tests/twisted/fakeconnectivity.py +++ b/tests/twisted/fakeconnectivity.py @@ -6,7 +6,9 @@ import sys class FakeConnectivity(object): NM_BUS_NAME = 'org.freedesktop.NetworkManager' NM_PATH = '/org/freedesktop/NetworkManager' + NM_PATH_SETTINGS = NM_PATH + '/Settings' NM_INTERFACE = NM_BUS_NAME + NM_INTERFACE_SETTINGS = NM_INTERFACE + '.Settings' NM_STATE_UNKNOWN = 0 NM_STATE_ASLEEP = 10 @@ -47,6 +49,13 @@ class FakeConnectivity(object): q.add_dbus_method_impl(self.NM_GetDevices, path=self.NM_PATH, interface=self.NM_INTERFACE, method='GetDevices') + q.add_dbus_method_impl(self.NM_Settings_Get, + path=self.NM_PATH_SETTINGS, interface=dbus.PROPERTIES_IFACE, method='Get', + predicate=lambda e: e.args[0] == self.NM_INTERFACE_SETTINGS) + q.add_dbus_method_impl(self.NM_Settings_GetAll, + path=self.NM_PATH_SETTINGS, interface=dbus.PROPERTIES_IFACE, method='GetAll', + predicate=lambda e: e.args[0] == self.NM_INTERFACE_SETTINGS) + q.add_dbus_method_impl(self.ConnMan_GetProperties, path=self.CONNMAN_PATH, interface=self.CONNMAN_INTERFACE, method='GetProperties') @@ -92,6 +101,19 @@ class FakeConnectivity(object): def NM_GetDevices(self, e): self.q.dbus_return(e.message, [], signature='ao') + def nm_settings_props(self): + return { + 'CanModify': False, + 'Hostname': 'localhost', + 'Connections': dbus.Array([], signature='o'), + } + + def NM_Settings_Get(self, e): + self.q.dbus_return(e.message, self.nm_settings_props()[e.args[1]], signature='v') + + def NM_Settings_GetAll(self, e): + self.q.dbus_return(e.message, self.nm_settings_props(), signature='a{sv}') + def Connman_props(self): return { 'OfflineMode': False, |