Merge lp:~jonas-drange/ubuntu-system-settings/mock-wifi-menu-items into lp:ubuntu-system-settings

Proposed by Jonas G. Drange on 2015-11-16
Status: Merged
Approved by: Ken VanDine on 2015-11-17
Approved revision: 1561
Merged at revision: 1579
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/mock-wifi-menu-items
Merge into: lp:ubuntu-system-settings
Diff against target: 144 lines (+102/-7)
1 file modified
tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py (+102/-7)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/mock-wifi-menu-items
Reviewer Review Type Date Requested Status
Ken VanDine 2015-11-16 Approve on 2015-11-17
PS Jenkins bot continuous-integration Needs Fixing on 2015-11-17
Review via email: mp+277566@code.launchpad.net

Commit Message

Expand indicator network mock to include access points, sections and switches via org.gtk.Menus.

To post a comment you must log in.
1561. By Jonas G. Drange on 2015-11-17

fix pep8

Ken VanDine (ken-vandine) wrote :

Looks good and tests pass :)

review: Approve
1562. By Jonas G. Drange on 2015-12-22

emtpy commit

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py'
2--- tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py 2015-08-17 15:39:14 +0000
3+++ tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py 2015-12-22 16:34:55 +0000
4@@ -17,6 +17,8 @@
5 BUS_NAME = 'com.canonical.indicator.network'
6 MAIN_IFACE = 'org.gtk.Actions'
7 MAIN_OBJ = '/com/canonical/indicator/network'
8+MENU_IFACE = 'org.gtk.Menus'
9+PHONE_WIFI_OBJ = '/com/canonical/indicator/network/phone_wifi_settings'
10 SYSTEM_BUS = False
11
12 NOT_IMPLEMENTED = '''raise dbus.exceptions.DBusException(
13@@ -41,8 +43,12 @@
14 return list(self.actions)
15
16
17-def set_state(self, action_name, parameters, platform_data):
18- eval(NOT_IMPLEMENTED)
19+def start(self, groups):
20+ return dbusmock.get_object(MAIN_OBJ).menus
21+
22+
23+def end(self, groups):
24+ pass
25
26
27 @dbus.service.method(dbusmock.MOCK_IFACE,
28@@ -62,12 +68,87 @@
29 mock.describe = describe
30 mock.describe_all = describe_all
31 mock.list_actions = list_actions
32- mock.set_state = set_state
33
34 mock.actions = parameters.get('actions', {
35 'wifi.enable': (True, '', [True]),
36+ 'accesspoint.0': (True, '', [True]),
37+ 'accesspoint.0::strength': (True, '', [44]),
38+ 'accesspoint.1': (True, '', [False]),
39+ 'accesspoint.1::strength': (True, '', [100]),
40+ 'accesspoint.2': (True, '', [False]),
41+ 'accesspoint.2::strength': (True, '', [74]),
42+ 'accesspoint.3': (False, '', [False]),
43 })
44
45+ mock.menus = parameters.get('menus', dbus.Array([
46+ (
47+ dbus.UInt32(0), dbus.UInt32(0),
48+ [
49+ {
50+ 'action': 'indicator.wifi.enable',
51+ 'x-canonical-type': 'com.canonical.indicator.switch',
52+ 'label': 'Wi-Fi'
53+ },
54+ {
55+ 'x-canonical-type': 'com.canonical.indicator.section',
56+ 'label': 'Available Wi-Fi networks'
57+ },
58+ {
59+ ':section': dbus.Struct(
60+ (dbus.UInt32(0), dbus.UInt32(1)), signature='(uu)'
61+ )
62+ }
63+ ]
64+ ),
65+ (
66+ dbus.UInt32(0), dbus.UInt32(1),
67+ [
68+ {
69+ 'x-canonical-wifi-ap-is-secure': True,
70+ 'x-canonical-wifi-ap-is-enterprise': False,
71+ 'label': 'Secure',
72+ 'x-canonical-type':
73+ 'unity.widgets.systemsettings.tablet.accesspoint',
74+ 'x-canonical-wifi-ap-strength-action':
75+ 'indicator.accesspoint.0::strength',
76+ 'action': 'indicator.accesspoint.0',
77+ 'x-canonical-wifi-ap-is-adhoc': False
78+ },
79+ {
80+ 'x-canonical-wifi-ap-is-secure': False,
81+ 'x-canonical-wifi-ap-is-enterprise': False,
82+ 'label': 'Insecure',
83+ 'x-canonical-type':
84+ 'unity.widgets.systemsettings.tablet.accesspoint',
85+ 'x-canonical-wifi-ap-strength-action':
86+ 'indicator.accesspoint.1::strength',
87+ 'action': 'indicator.accesspoint.1',
88+ 'x-canonical-wifi-ap-is-adhoc': False
89+ },
90+ {
91+ 'x-canonical-wifi-ap-is-secure': True,
92+ 'x-canonical-wifi-ap-is-enterprise': True,
93+ 'label': 'Enterprise',
94+ 'x-canonical-type':
95+ 'unity.widgets.systemsettings.tablet.accesspoint',
96+ 'x-canonical-wifi-ap-strength-action':
97+ 'indicator.accesspoint.2::strength',
98+ 'action': 'indicator.accesspoint.2',
99+ 'x-canonical-wifi-ap-is-adhoc': False
100+ },
101+ {
102+ 'x-canonical-wifi-ap-is-secure': False,
103+ 'x-canonical-wifi-ap-is-enterprise': False,
104+ 'label': 'Unknown',
105+ 'x-canonical-type':
106+ 'unknown-type',
107+ 'action': 'indicator.accesspoint.3',
108+ 'x-canonical-wifi-ap-is-adhoc': False
109+ }
110+ ]
111+ )
112+ ], signature='a(uuaa{sv})'))
113+
114 mock.AddMethods(
115 MAIN_IFACE,
116 [
117@@ -85,9 +166,23 @@
118 (
119 'List', '', 'as',
120 'ret = self.list_actions(self)'
121- ),
122- (
123- 'SetState', 'sva{sv}', '',
124- 'self.set_state(self, args[0], args[1], args[2])'
125 )
126 ])
127+
128+ mock.AddObject(
129+ PHONE_WIFI_OBJ,
130+ MENU_IFACE, {}, [
131+ (
132+ 'Start', 'au', 'a(uuaa{sv})',
133+ 'ret = self.start(self, args[0])'
134+ ),
135+ (
136+ 'End', 'au', '',
137+ 'ret = self.end(self, args[0])'
138+ )
139+ ]
140+ )
141+
142+ phone_wifi_obj = dbusmock.get_object(PHONE_WIFI_OBJ)
143+ phone_wifi_obj.start = start
144+ phone_wifi_obj.end = end

Subscribers

People subscribed via source and target branches