mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 18:20:29 +01:00
libnm/tests: fix stub implementation for remote-next-connection
We cannot first remove the connection (and emit property changed signals), before replying with the newly added path (that already no longer exists). Fix the stub implementation.
This commit is contained in:
parent
6bf206eb81
commit
44a56fca60
1 changed files with 16 additions and 3 deletions
|
|
@ -1592,6 +1592,9 @@ class Connection(ExportedObj):
|
|||
|
||||
@dbus.service.method(dbus_interface=IFACE_CONNECTION, in_signature='', out_signature='a{sa{sv}}')
|
||||
def GetSettings(self):
|
||||
if hasattr(self, '_remove_next_connection_cb'):
|
||||
self._remove_next_connection_cb()
|
||||
raise BusErr.UnknownConnectionException("Connection not found")
|
||||
if not self.visible:
|
||||
raise BusErr.PermissionDeniedException()
|
||||
return self.con_hash
|
||||
|
|
@ -1694,11 +1697,21 @@ class Settings(ExportedObj):
|
|||
self.NewConnection(con_inst.path)
|
||||
self._dbus_property_set(IFACE_SETTINGS, PRP_SETTINGS_CONNECTIONS, dbus.Array(self.get_connection_paths(), 'o'))
|
||||
|
||||
gl.manager.devices_available_connections_update()
|
||||
|
||||
if self.remove_next_connection:
|
||||
self.remove_next_connection = False
|
||||
self.delete_connection(con_inst)
|
||||
|
||||
gl.manager.devices_available_connections_update()
|
||||
def cb():
|
||||
if hasattr(con_inst, '_remove_next_connection_cb'):
|
||||
del con_inst._remove_next_connection_cb
|
||||
self.delete_connection(con_inst)
|
||||
return False
|
||||
# We will delete the connection right away on an idle handler. However,
|
||||
# the test races with initializing the connection (calling GetSettings()).
|
||||
# To avoid the race, we will check in GetSettings() whether the profile
|
||||
# is about to be deleted, and delete it first.
|
||||
con_inst._remove_next_connection_cb = cb
|
||||
GLib.idle_add(cb)
|
||||
|
||||
return con_inst.path
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue