Remove now deprecated test scripts
[platform/upstream/connman.git] / test / test-manager
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SystemBus()
6
7 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
8                                         "org.moblin.connman.Manager")
9
10 properties = manager.GetProperties()
11
12 def print_properties(key, value):
13         if key == "Profiles":
14                 interface = "org.moblin.connman.Profile"
15         elif key == "Devices":
16                 interface = "org.moblin.connman.Device"
17         elif key == "Services":
18                 interface = "org.moblin.connman.Service"
19         else:
20                 return
21
22         print "%s" % (key)
23         for path in value:
24                 print "    %s" % (path)
25                 obj = dbus.Interface(bus.get_object("org.moblin.connman", path),
26                                                                 interface)
27
28                 properties = obj.GetProperties()
29
30                 for key in properties.keys():
31                         if key in ["Networks", "Services"]:
32                                 continue
33
34                         if key in ["Powered", "Scanning", "Connected",
35                                         "Available", "Remember", "Default"]:
36                                 if properties[key] == dbus.Boolean(1):
37                                         val = "true"
38                                 else:
39                                         val = "false"
40                         elif key in ["Strength", "Priority"]:
41                                 val = int(properties[key])
42                         else:
43                                 val = str(properties[key])
44
45                         print "        %s = %s" % (key, val)
46
47                 if "Networks" in properties.keys():
48                         list = ""
49                         for path in properties["Networks"]:
50                                 val = str(path)
51                                 list = list + val[val.rfind("/") + 1:] + " "
52                         print "        Networks = [ %s]" % (list)
53                 if "Services" in properties.keys():
54                         list = ""
55                         for path in properties["Services"]:
56                                 val = str(path)
57                                 list = list + val[val.rfind("/") + 1:] + " "
58                         print "        Services = [ %s]" % (list)
59
60 for key in properties.keys():
61         if key in ["Profiles", "Devices", "Services"]:
62                 print_properties(key, properties[key])
63         elif key in ["AvailableTechnologies", "EnabledTechnologies",
64                                         "ConnectedTechnologies",
65                                 "AvailableDebugs", "EnabledDebugs"]:
66                 print "%s" % (key)
67                 list = ""
68                 for val in properties[key]:
69                         list = list + val + " "
70                 print "    [ %s]" % (list)
71         elif key in ["OfflineMode"]:
72                 print "%s" % (key)
73                 if properties[key] == dbus.Boolean(1):
74                         print "    true"
75                 else:
76                         print "    false"
77         elif key in ["DefaultTechnology"]:
78                 print "%s" % (key)
79                 if properties[key] == "":
80                         print "    <none>"
81                 else:
82                         print "    %s" % (properties[key])
83         else:
84                 print "%s" % (key)
85                 print "    %s" % (properties[key])