summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Vaclav <jvaclav@redhat.com>2024-02-21 13:55:51 +0100
committerFernando Fernandez Mancera <ffmancera@riseup.net>2024-03-11 11:42:19 +0100
commit5672757ac4942c4801183074a5051588fc226006 (patch)
tree330bd05af7d4180b29e256a43a305408c158b79e
parentfda0f8435dc34055278c0c9ad5d3ca6795c46a86 (diff)
test/networkmanager-service: simulate behavior of aliased/deprecated properties
Previously, the mock server did not behave as expected when given an aliased property and the test results were not matching that of actual NM daemon behavior.
-rwxr-xr-xtools/test-networkmanager-service.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 80e7a0012b..957f076f3a 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -31,6 +31,34 @@ _DEFAULT_ARG = object()
###############################################################################
+class AliasedProperty:
+ def __init__(self, old_name, new_name):
+ self.old_name = old_name
+ self.new_name = new_name
+
+
+ALIASED_PROPERTIES = {
+ NM.SETTING_CONNECTION_SETTING_NAME: [
+ AliasedProperty(
+ NM.SETTING_CONNECTION_MASTER,
+ "controller", # NM.SETTING_CONNECTION_CONTROLLER
+ ),
+ AliasedProperty(
+ NM.SETTING_CONNECTION_SLAVE_TYPE,
+ "port-type", # NM.SETTING_CONNECTION_PORT_TYPE
+ ),
+ AliasedProperty(NM.SETTING_CONNECTION_AUTOCONNECT_SLAVES, "autoconnect-ports"),
+ ],
+ NM.SETTING_WIRELESS_SETTING_NAME: [
+ AliasedProperty(
+ NM.SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, "mac-address-denylist"
+ )
+ ],
+}
+
+###############################################################################
+
+
class Global:
pass
@@ -2118,6 +2146,13 @@ class Connection(ExportedObj):
out_signature="a{sv}",
)
def Update2(self, con_hash, flags, args):
+ for setting_name in ALIASED_PROPERTIES.keys():
+ if setting_name in con_hash:
+ setting = con_hash[setting_name]
+ for pty in ALIASED_PROPERTIES[setting_name]:
+ if pty.new_name in setting and pty.old_name in setting:
+ del setting[pty.new_name]
+
self.update_connection(con_hash, True)
return []