From 1bd31c1e11af97ac3b30aefda58f8f5ca4a706b9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 5 Nov 2010 11:51:23 +0100 Subject: [PATCH] Remove test scripts for no longer existing interfaces --- Makefile.am | 4 +- test/disable-device | 37 ---------- test/enable-device | 37 ---------- test/list-devices | 35 ---------- test/list-networks | 60 ----------------- test/set-passphrase | 43 ------------ test/start-scanning | 33 --------- test/test-connman | 191 ---------------------------------------------------- test/test-manager | 20 +----- 9 files changed, 3 insertions(+), 457 deletions(-) delete mode 100755 test/disable-device delete mode 100755 test/enable-device delete mode 100755 test/list-devices delete mode 100755 test/list-networks delete mode 100755 test/set-passphrase delete mode 100755 test/start-scanning diff --git a/Makefile.am b/Makefile.am index 71b739e..cca54aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,9 +175,7 @@ endif test_scripts = test/get-state test/list-profiles test/list-services \ test/connect-service test/monitor-services \ - test/list-devices test/enable-device test/disable-device \ - test/start-scanning test/list-networks \ - test/set-passphrase test/set-address test/test-profile \ + test/set-address test/test-profile \ test/simple-agent test/show-introspection test/test-compat \ test/test-manager test/test-connman test/monitor-connman \ test/connect-vpn test/disconnect-vpn test/list-providers \ diff --git a/test/disable-device b/test/disable-device deleted file mode 100755 index acf962b..0000000 --- a/test/disable-device +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import sys -import dbus - -if (len(sys.argv) < 2): - print "Usage: %s " % (sys.argv[0]) - sys.exit(1) - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"), - 'org.moblin.connman.Manager') - -properties = manager.GetProperties() - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object('org.moblin.connman', path), - 'org.moblin.connman.Device') - - properties = device.GetProperties() - - if "Interface" not in properties.keys(): - continue - - if properties["Interface"] != sys.argv[1]: - continue - - print "Disabling device %s" % (path) - - device.SetProperty("Powered", dbus.Boolean(0)); diff --git a/test/enable-device b/test/enable-device deleted file mode 100755 index e6f9518..0000000 --- a/test/enable-device +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import sys -import dbus - -if (len(sys.argv) < 2): - print "Usage: %s " % (sys.argv[0]) - sys.exit(1) - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"), - 'org.moblin.connman.Manager') - -properties = manager.GetProperties() - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object('org.moblin.connman', path), - 'org.moblin.connman.Device') - - properties = device.GetProperties() - - if "Interface" not in properties.keys(): - continue - - if properties["Interface"] != sys.argv[1]: - continue - - print "Enabling device %s" % (path) - - device.SetProperty("Powered", dbus.Boolean(1)); diff --git a/test/list-devices b/test/list-devices deleted file mode 100755 index 78c319b..0000000 --- a/test/list-devices +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python - -import dbus - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), - "org.moblin.connman.Manager") - -properties = manager.GetProperties() - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Device") - - properties = device.GetProperties() - - print "[ %s ]" % (path) - - for key in properties.keys(): - if key in ["Networks"]: - val = "" - for i in properties[key]: - val += i + " " - else: - val = str(properties[key]) - print " %s = %s" % (key, val) - - print diff --git a/test/list-networks b/test/list-networks deleted file mode 100755 index 052d318..0000000 --- a/test/list-networks +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/python - -import dbus -import string - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), - "org.moblin.connman.Manager") - -properties = manager.GetProperties() - -def convert_ssid(ssid_list): - ssid = "" - for byte in ssid_list: - if (str(byte) in string.printable): - ssid = ssid + str(byte) - else: - ssid = ssid + "." - return ssid - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Device") - - properties = device.GetProperties() - - try: - if properties["Type"] not in ["ethernet", "wifi", "wimax", - "bluetooth", "cellular"]: - continue - except: - continue - - print "[ %s ]" % (path) - - for path in properties["Networks"]: - network = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Network") - - properties = network.GetProperties() - - print " [ %s ]" % (path) - - for key in properties.keys(): - if key == "WiFi.SSID": - ssid = convert_ssid(properties[key]) - print " %s = [ %s ]" % (key, ssid) - elif key in ["Strength", "Priority"]: - print " %s = %d" % (key, properties[key]) - else: - print " %s = %s" % (key, properties[key]) - - print diff --git a/test/set-passphrase b/test/set-passphrase deleted file mode 100755 index acce350..0000000 --- a/test/set-passphrase +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python - -import sys -import dbus - -if (len(sys.argv) < 3): - print "Usage: %s " % (sys.argv[0]) - sys.exit(1) - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), - "org.moblin.connman.Manager") - -properties = manager.GetProperties() - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Device") - - properties = device.GetProperties() - - if (properties["Type"] != "wifi" and properties["Type"] != "wimax"): - continue; - - for path in properties["Networks"]: - network = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Network") - - properties = network.GetProperties() - - if "Name" not in properties: - continue - - if properties["Name"] == sys.argv[1]: - print "Setting passphrase for %s" % (path) - network.SetProperty("WiFi.Passphrase", sys.argv[2]) diff --git a/test/start-scanning b/test/start-scanning deleted file mode 100755 index e3bac28..0000000 --- a/test/start-scanning +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python - -import dbus - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"), - 'org.moblin.connman.Manager') - -properties = manager.GetProperties() - -for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object('org.moblin.connman', path), - 'org.moblin.connman.Technology') - properties = technology.GetProperties() - - print "[ %s ]" % (path) - - if properties["Type"] in ["wifi", "wimax"]: - - print " Started scanning" - - for path in properties["Devices"]: - device = dbus.Interface(bus.get_object('org.moblin.connman', path), - 'org.moblin.connman.Device') - try: - device.ProposeScan() - except dbus.DBusException, error: - print " %s: %s" % (error._dbus_error_name, error.message) - else: - print " No scanning" - - print diff --git a/test/test-connman b/test/test-connman index 174525a..4336e2d 100755 --- a/test/test-connman +++ b/test/test-connman @@ -24,110 +24,8 @@ if len(sys.argv) < 2: print " enable " print " disable " print " offlinemode [on|off]" - print "" - print " dev " - print " dev scan" - print " dev scan_interval " - print " dev networks" - print " dev connect " - print " dev disconnect [network]" - print " dev powered [on|off]" sys.exit(1) -def print_properties(path, properties): - print "[ %s ]" % (path) - for key in properties.keys(): - if key == "Networks": - continue - - if key in ["Powered", "Scanning", "Connected", - "Available", "Remember", "Default"]: - if properties[key] == dbus.Boolean(1): - val = "true" - else: - val = "false" - elif key in ["Strength", "Priority"]: - val = int(properties[key]) - else: - val = str(properties[key]) - - print " %s = %s" % (key, val) - - if "Networks" in properties.keys(): - list = "" - for path in properties["Networks"]: - val = str(path) - list = list + val[val.rfind("/") + 1:] + " " - print " Networks = [ %s]" % (list) - -def print_networks(networks): - for path in networks: - network = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Network") - - properties = network.GetProperties() - - if properties["Connected"] == dbus.Boolean(1): - connected = "*" - else: - connected = " " - - if "Name" in properties.keys(): - name = properties["Name"] - else: - name = "" - - strength = int(properties["Strength"]) - - details = "" - try: - details += "{" + properties["WiFi.Mode"] + "} " - except: - pass - try: - details += "{" + properties["WiFi.Security"] + "} " - except: - pass - if "WiFi.Passphrase" in properties.keys(): - if properties["WiFi.Passphrase"] != "": - details += "{passphrase present}" - - print "%s %-26s %3d%% %s" % (connected, - name, strength, details) - -def select_network(networks, name): - for path in networks: - network = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Network") - - properties = network.GetProperties() - - if properties["Name"] != name: - continue - - if properties["Connected"] == dbus.Boolean(1): - print "Already connected to network %s" % (name) - break - - print "Selecting network %s" % (name) - - network.Connect() - -def disconnect_network(networks, name): - for path in networks: - network = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Network") - - properties = network.GetProperties() - - if name != "" and properties["Name"] != name: - continue - - if properties["Connected"] == dbus.Boolean(1): - name = properties["Name"] - print "Disconnecting from network %s" % (name) - network.Disconnect() - def print_services(services): for path in services: service = dbus.Interface(bus.get_object("org.moblin.connman", path), @@ -149,72 +47,6 @@ def print_services(services): print "%s %-26s { %s }" % (favorite, name, identifier) -def device_handle(devices, interface): - for path in devices: - device = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Device") - - properties = device.GetProperties() - - if "Interface" not in properties.keys(): - continue - - if interface != "" and properties["Interface"] != interface: - continue - - if command == "scan": - if properties["Type"] in ["wifi", "wimax"]: - interface = properties["Interface"] - print "Scan for device %s" % (interface) - device.ProposeScan() - else: - print "No scanning for device %s" % (interface) - elif command == "scan_interval" and value != "": - device.SetProperty("ScanInterval", dbus.UInt16(value)) - elif command in ["networks", "net"]: - if "Networks" in properties.keys(): - print_networks(properties["Networks"]) - else: - print "Device has no networks" - elif command in ["connect", "conn"] and value != "": - if "Networks" in properties.keys(): - select_network(properties["Networks"], value) - else: - print "Device can't connect networks" - elif command in ["connect", "conn"]: - print "Need to specify network" - elif command in ["disconnect", "disc"] and value != "": - if "Networks" in properties.keys(): - disconnect_network(properties["Networks"], value) - else: - print "Device has no networks" - elif command in ["discconnect", "disc"]: - if "Networks" in properties.keys(): - disconnect_network(properties["Networks"], "") - else: - print "Device has no networks" - elif command == "powered" and value != "": - if value == "on": - powered = dbus.Boolean(1) - elif value == "off": - powered = dbus.Boolean(0) - else: - powered = dbus.Boolean(value) - device.SetProperty("Powered", powered) - elif command == "powered": - interface = properties["Interface"] - if properties["Powered"] == dbus.Boolean(1): - powered = "on" - else: - powered = "off" - print "Device %s is powered %s" % (interface, powered) - elif command == "list" or command == "": - print_properties(path, properties) - else: - print "Unknown command" - - - if sys.argv[1] == "state": properties = manager.GetProperties() @@ -401,28 +233,5 @@ elif sys.argv[1] in ["offlinemode", "flightmode"]: properties = manager.GetProperties() print "Offline mode is %s" % (properties["OfflineMode"]) -elif sys.argv[1] == "dev": - properties = manager.GetProperties() - - interface = "" - command = "" - value = "" - found = 0 - - if len(sys.argv) > 2: - interface = sys.argv[2] - if len(sys.argv) > 3: - command = sys.argv[3] - if len(sys.argv) > 4: - value = sys.argv[4] - - for path in properties["Technologies"]: - technology = dbus.Interface(bus.get_object("org.moblin.connman", path), - "org.moblin.connman.Technology") - - properties = technology.GetProperties() - - device_handle(properties["Devices"], interface) - else: print "Unknown command" diff --git a/test/test-manager b/test/test-manager index 2a967f5..2a80b75 100755 --- a/test/test-manager +++ b/test/test-manager @@ -33,8 +33,6 @@ properties = manager.GetProperties() def print_properties(key, value): if key == "Profiles": interface = "org.moblin.connman.Profile" - elif key == "Devices": - interface = "org.moblin.connman.Device" elif key in ["Services", "Providers"]: interface = "org.moblin.connman.Service" elif key == "Technologies": @@ -51,8 +49,7 @@ def print_properties(key, value): properties = obj.GetProperties() for key in properties.keys(): - if key in ["Devices", "Networks", "Services", - "Providers", "Technologies"]: + if key in ["Services", "Providers", "Technologies"]: continue elif key in ["Powered", "Scanning", "Connected", @@ -82,18 +79,6 @@ def print_properties(key, value): print " %s = %s" % (key, val) - if "Devices" in properties.keys(): - list = "" - for path in properties["Devices"]: - val = str(path) - list = list + val[val.rfind("/") + 1:] + " " - print " Devices = [ %s]" % (list) - if "Networks" in properties.keys(): - list = "" - for path in properties["Networks"]: - val = str(path) - list = list + val[val.rfind("/") + 1:] + " " - print " Networks = [ %s]" % (list) if "Services" in properties.keys(): list = "" for path in properties["Services"]: @@ -109,8 +94,7 @@ def print_properties(key, value): for key in properties.keys(): - if key in ["Profiles", "Devices", "Services", "Providers", - "Technologies"]: + if key in ["Profiles", "Services", "Providers", "Technologies"]: print_properties(key, properties[key]) elif key in ["AvailableTechnologies", "EnabledTechnologies", "ConnectedTechnologies", -- 2.7.4