Merge lp:~jonas-drange/indicator-network/allow-auth-none into lp:indicator-network/15.10
- allow-auth-none
- Merge into trunk.15.10
Status: | Merged |
---|---|
Approved by: | Pete Woods |
Approved revision: | 529 |
Merged at revision: | 523 |
Proposed branch: | lp:~jonas-drange/indicator-network/allow-auth-none |
Merge into: | lp:indicator-network/15.10 |
Diff against target: |
554 lines (+224/-15) 12 files modified
data/com.ubuntu.connectivity1.Private.xml (+6/-1) debian/changelog (+8/-0) src/connectivity-api/connectivity-qt/connectivityqt/connectivity.cpp (+14/-0) src/connectivity-api/connectivity-qt/connectivityqt/connectivity.h (+7/-0) src/indicator/connectivity-service/connectivity-service.cpp (+20/-0) src/indicator/connectivity-service/connectivity-service.h (+5/-0) src/indicator/nmofono/hotspot-manager.cpp (+33/-11) src/indicator/nmofono/hotspot-manager.h (+15/-3) src/indicator/nmofono/manager-impl.cpp (+13/-0) src/indicator/nmofono/manager-impl.h (+4/-0) src/indicator/nmofono/manager.h (+7/-0) tests/integration/test-connectivity-api.cpp (+92/-0) |
To merge this branch: | bzr merge lp:~jonas-drange/indicator-network/allow-auth-none |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Indicator Applet Developers | Pending | ||
Review via email: mp+269666@code.launchpad.net |
Commit message
Allow creation and configuration of insecure hotspot via the connectivity service. Bumped version due to new API.
Description of the change
We should allow the user to create and configure an insecure hotspot via the Connectivity API.
* Allow for “wpa-psk” and “none” authentication schemes at creation and configuration time. “none” does not mean WEP—we've decided to never support WEP, since it gives a false sense of security.
* Detect a insecure hotspot on startup.
- 522. By Jonas G. Drange
-
revert po changes
- 523. By Jonas G. Drange
-
undo line addition
PS Jenkins bot (ps-jenkins) wrote : | # |
- 524. By Jonas G. Drange
-
add failing test
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:524
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 525. By Jonas G. Drange
-
don't need device, and use correct dbus object path
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:525
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 526. By Jonas G. Drange
-
bump version
- 527. By Jonas G. Drange
-
bump dep properly this time
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:527
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 528. By Jonas G. Drange
-
re-add trailing whitespace
- 529. By Jonas G. Drange
-
re-add trailing whitespace
Preview Diff
1 | === modified file 'data/com.ubuntu.connectivity1.Private.xml' |
2 | --- data/com.ubuntu.connectivity1.Private.xml 2015-07-15 11:20:26 +0000 |
3 | +++ data/com.ubuntu.connectivity1.Private.xml 2015-09-09 12:18:20 +0000 |
4 | @@ -9,7 +9,6 @@ |
5 | <method name="UnlockModem"> |
6 | <arg type="s" direction="in" name="modem"/> |
7 | </method> |
8 | - |
9 | <method name="SetFlightMode"> |
10 | <arg type="b" direction="in" name="enabled"/> |
11 | </method> |
12 | @@ -34,8 +33,14 @@ |
13 | <arg type="s" direction="in" name="mode"/> |
14 | </method> |
15 | |
16 | + <method name="SetHotspotAuth"> |
17 | + <arg type="s" direction="in" name="auth"/> |
18 | + </method> |
19 | + |
20 | <property name="HotspotPassword" type="s" access="read"/> |
21 | |
22 | + <property name="HotspotAuth" type="s" access="read"/> |
23 | + |
24 | <signal name="ReportError"> |
25 | <arg type="i" direction="out" name="reason"/> |
26 | </signal> |
27 | |
28 | === modified file 'debian/changelog' |
29 | --- debian/changelog 2015-08-18 08:46:30 +0000 |
30 | +++ debian/changelog 2015-09-09 12:18:20 +0000 |
31 | @@ -1,3 +1,11 @@ |
32 | +indicator-network (0.5.4-0ubuntu1) UNRELEASED; urgency=medium |
33 | + |
34 | + [ jonas-drange] |
35 | + * Allow creation and configuration of insecure hotspot via the |
36 | + connectivity service (LP: #1431876) |
37 | + |
38 | + -- Jonas G. Drange <jonas.drange@canonical.com> Thu, 03 Sep 2015 14:49:46 +0200 |
39 | + |
40 | indicator-network (0.5.3+15.10.20150818-0ubuntu1) wily; urgency=medium |
41 | |
42 | [ Pete Woods ] |
43 | |
44 | === modified file 'src/connectivity-api/connectivity-qt/connectivityqt/connectivity.cpp' |
45 | --- src/connectivity-api/connectivity-qt/connectivityqt/connectivity.cpp 2015-08-16 16:43:16 +0000 |
46 | +++ src/connectivity-api/connectivity-qt/connectivityqt/connectivity.cpp 2015-09-09 12:18:20 +0000 |
47 | @@ -146,6 +146,10 @@ |
48 | { |
49 | Q_EMIT p.hotspotModeUpdated(value.toString()); |
50 | } |
51 | + else if (name == "HotspotAuth") |
52 | + { |
53 | + Q_EMIT p.hotspotAuthUpdated(value.toString()); |
54 | + } |
55 | else if (name == "HotspotStored") |
56 | { |
57 | Q_EMIT p.hotspotStoredUpdated(value.toBool()); |
58 | @@ -295,6 +299,11 @@ |
59 | return d->m_propertyCache->get("HotspotMode").toString(); |
60 | } |
61 | |
62 | +QString Connectivity::hotspotAuth() const |
63 | +{ |
64 | + return d->m_writePropertyCache->get("HotspotAuth").toString(); |
65 | +} |
66 | + |
67 | bool Connectivity::hotspotStored() const |
68 | { |
69 | return d->m_propertyCache->get("HotspotStored").toBool(); |
70 | @@ -323,6 +332,11 @@ |
71 | d->m_writeInterface->SetHotspotMode(mode); |
72 | } |
73 | |
74 | +void Connectivity::setHotspotAuth(const QString& auth) |
75 | +{ |
76 | + d->m_writeInterface->SetHotspotAuth(auth); |
77 | +} |
78 | + |
79 | } |
80 | |
81 | #include "connectivity.moc" |
82 | |
83 | === modified file 'src/connectivity-api/connectivity-qt/connectivityqt/connectivity.h' |
84 | --- src/connectivity-api/connectivity-qt/connectivityqt/connectivity.h 2015-08-14 16:03:42 +0000 |
85 | +++ src/connectivity-api/connectivity-qt/connectivityqt/connectivity.h 2015-09-09 12:18:20 +0000 |
86 | @@ -120,6 +120,9 @@ |
87 | Q_PROPERTY(QString hotspotMode READ hotspotMode WRITE setHotspotMode NOTIFY hotspotModeUpdated) |
88 | QString hotspotMode() const; |
89 | |
90 | + Q_PROPERTY(QString hotspotAuth READ hotspotAuth WRITE setHotspotAuth NOTIFY hotspotAuthUpdated) |
91 | + QString hotspotAuth() const; |
92 | + |
93 | Q_PROPERTY(bool hotspotStored READ hotspotStored NOTIFY hotspotStoredUpdated) |
94 | bool hotspotStored() const; |
95 | |
96 | @@ -139,6 +142,8 @@ |
97 | |
98 | void setHotspotMode(const QString& mode); |
99 | |
100 | + void setHotspotAuth(const QString& auth); |
101 | + |
102 | Q_SIGNALS: |
103 | void flightModeUpdated(bool); |
104 | |
105 | @@ -168,6 +173,8 @@ |
106 | |
107 | void hotspotModeUpdated(const QString& mode); |
108 | |
109 | + void hotspotAuthUpdated(const QString& auth); |
110 | + |
111 | void hotspotStoredUpdated(bool); |
112 | |
113 | void reportError(int reason); |
114 | |
115 | === modified file 'src/indicator/connectivity-service/connectivity-service.cpp' |
116 | --- src/indicator/connectivity-service/connectivity-service.cpp 2015-08-17 15:38:34 +0000 |
117 | +++ src/indicator/connectivity-service/connectivity-service.cpp 2015-09-09 12:18:20 +0000 |
118 | @@ -137,6 +137,15 @@ |
119 | { "HotspotMode" }); |
120 | } |
121 | |
122 | + // Note that this is on the private object |
123 | + void hotspotAuthUpdated() |
124 | + { |
125 | + notifyPropertyChanged(*m_privateService, |
126 | + DBusTypes::PRIVATE_PATH, |
127 | + DBusTypes::PRIVATE_INTERFACE, |
128 | + { "HotspotAuth" }); |
129 | + } |
130 | + |
131 | void hotspotStoredUpdated() |
132 | { |
133 | notifyPropertyChanged(p, |
134 | @@ -211,6 +220,7 @@ |
135 | connect(d->m_manager.get(), &Manager::hotspotSsidChanged, d.get(), &Private::hotspotSsidUpdated); |
136 | connect(d->m_manager.get(), &Manager::hotspotPasswordChanged, d.get(), &Private::hotspotPasswordUpdated); |
137 | connect(d->m_manager.get(), &Manager::hotspotModeChanged, d.get(), &Private::hotspotModeUpdated); |
138 | + connect(d->m_manager.get(), &Manager::hotspotAuthChanged, d.get(), &Private::hotspotAuthUpdated); |
139 | connect(d->m_manager.get(), &Manager::hotspotStoredChanged, d.get(), &Private::hotspotStoredUpdated); |
140 | |
141 | connect(d->m_manager.get(), &Manager::reportError, d->m_privateService.get(), &PrivateService::ReportError); |
142 | @@ -342,11 +352,21 @@ |
143 | p.d->m_manager->setHotspotMode(mode); |
144 | } |
145 | |
146 | +void PrivateService::SetHotspotAuth(const QString &auth) |
147 | +{ |
148 | + p.d->m_manager->setHotspotAuth(auth); |
149 | +} |
150 | + |
151 | QString PrivateService::hotspotPassword() const |
152 | { |
153 | return p.d->m_manager->hotspotPassword(); |
154 | } |
155 | |
156 | +QString PrivateService::hotspotAuth() const |
157 | +{ |
158 | + return p.d->m_manager->hotspotAuth(); |
159 | +} |
160 | + |
161 | } |
162 | |
163 | #include "connectivity-service.moc" |
164 | |
165 | === modified file 'src/indicator/connectivity-service/connectivity-service.h' |
166 | --- src/indicator/connectivity-service/connectivity-service.h 2015-08-14 10:29:55 +0000 |
167 | +++ src/indicator/connectivity-service/connectivity-service.h 2015-09-09 12:18:20 +0000 |
168 | @@ -96,6 +96,9 @@ |
169 | Q_PROPERTY(QString HotspotPassword READ hotspotPassword) |
170 | QString hotspotPassword() const; |
171 | |
172 | + Q_PROPERTY(QString HotspotAuth READ hotspotAuth) |
173 | + QString hotspotAuth() const; |
174 | + |
175 | protected Q_SLOTS: |
176 | void UnlockAllModems(); |
177 | |
178 | @@ -113,6 +116,8 @@ |
179 | |
180 | void SetHotspotMode(const QString &mode); |
181 | |
182 | + void SetHotspotAuth(const QString &auth); |
183 | + |
184 | Q_SIGNALS: |
185 | void ReportError(int reason); |
186 | |
187 | |
188 | === modified file 'src/indicator/nmofono/hotspot-manager.cpp' |
189 | --- src/indicator/nmofono/hotspot-manager.cpp 2015-08-17 11:01:23 +0000 |
190 | +++ src/indicator/nmofono/hotspot-manager.cpp 2015-09-09 12:18:20 +0000 |
191 | @@ -67,7 +67,7 @@ |
192 | // Get new settings |
193 | QVariantDictMap new_settings = createConnectionSettings(m_ssid, |
194 | m_password, |
195 | - m_mode, false); |
196 | + m_mode, m_auth, false); |
197 | auto updating = m_hotspot->Update(new_settings); |
198 | updating.waitForFinished(); |
199 | if (!updating.isValid()) |
200 | @@ -190,6 +190,8 @@ |
201 | { |
202 | p.setPassword(pwd); |
203 | } |
204 | + } else { |
205 | + p.setAuth("none"); |
206 | } |
207 | } |
208 | |
209 | @@ -302,7 +304,7 @@ |
210 | */ |
211 | QVariantDictMap createConnectionSettings( |
212 | const QByteArray &ssid, const QString &password, |
213 | - QString mode, bool autoConnect = true) |
214 | + QString mode, QString auth, bool autoConnect = true) |
215 | { |
216 | QVariantDictMap connection; |
217 | |
218 | @@ -313,7 +315,11 @@ |
219 | s_uuid.remove(s_uuid.size() - 1, 1); |
220 | |
221 | QVariantMap wireless; |
222 | - wireless[QStringLiteral("security")] = QVariant(QStringLiteral("802-11-wireless-security")); |
223 | + |
224 | + if (auth != "none") |
225 | + { |
226 | + wireless[QStringLiteral("security")] = QVariant(QStringLiteral("802-11-wireless-security")); |
227 | + } |
228 | wireless[QStringLiteral("ssid")] = QVariant(ssid); |
229 | wireless[QStringLiteral("mode")] = QVariant(mode); |
230 | |
231 | @@ -337,13 +343,16 @@ |
232 | ipv6[QStringLiteral("method")] = QVariant(QStringLiteral("ignore")); |
233 | connection["ipv6"] = ipv6; |
234 | |
235 | - QVariantMap security; |
236 | - security[QStringLiteral("proto")] = QVariant(QStringList{ "rsn" }); |
237 | - security[QStringLiteral("pairwise")] = QVariant(QStringList{ "ccmp" }); |
238 | - security[QStringLiteral("group")] = QVariant(QStringList{ "ccmp" }); |
239 | - security[QStringLiteral("key-mgmt")] = QVariant(QStringLiteral("wpa-psk")); |
240 | - security[QStringLiteral("psk")] = QVariant(password); |
241 | - connection["802-11-wireless-security"] = security; |
242 | + if (auth != "none") |
243 | + { |
244 | + QVariantMap security; |
245 | + security[QStringLiteral("proto")] = QVariant(QStringList{ "rsn" }); |
246 | + security[QStringLiteral("pairwise")] = QVariant(QStringList{ "ccmp" }); |
247 | + security[QStringLiteral("group")] = QVariant(QStringList{ "ccmp" }); |
248 | + security[QStringLiteral("key-mgmt")] = QVariant(auth); |
249 | + security[QStringLiteral("psk")] = QVariant(password); |
250 | + connection["802-11-wireless-security"] = security; |
251 | + } |
252 | |
253 | return connection; |
254 | } |
255 | @@ -382,7 +391,7 @@ |
256 | void addConnection() |
257 | { |
258 | QVariantDictMap connection = createConnectionSettings(m_ssid, m_password, |
259 | - m_mode); |
260 | + m_mode, m_auth); |
261 | |
262 | auto add_connection_reply = m_settings->AddConnection(connection); |
263 | add_connection_reply.waitForFinished(); |
264 | @@ -627,6 +636,7 @@ |
265 | HotspotManager& p; |
266 | |
267 | QString m_mode = "ap"; |
268 | + QString m_auth = "wpa-psk"; |
269 | bool m_enabled = false; |
270 | bool m_stored = false; |
271 | QString m_password; |
272 | @@ -816,6 +826,10 @@ |
273 | return d->m_mode; |
274 | } |
275 | |
276 | +QString HotspotManager::auth() const { |
277 | + return d->m_auth; |
278 | +} |
279 | + |
280 | void HotspotManager::setMode(const QString& value) { |
281 | if (d->m_mode != value) |
282 | { |
283 | @@ -824,6 +838,14 @@ |
284 | } |
285 | } |
286 | |
287 | +void HotspotManager::setAuth(const QString& value) { |
288 | + if (d->m_auth != value) |
289 | + { |
290 | + d->m_auth = value; |
291 | + Q_EMIT authChanged(value); |
292 | + } |
293 | +} |
294 | + |
295 | bool HotspotManager::disconnectWifi() const |
296 | { |
297 | return d->m_disconnectWifi; |
298 | |
299 | === modified file 'src/indicator/nmofono/hotspot-manager.h' |
300 | --- src/indicator/nmofono/hotspot-manager.h 2015-08-17 11:01:23 +0000 |
301 | +++ src/indicator/nmofono/hotspot-manager.h 2015-09-09 12:18:20 +0000 |
302 | @@ -70,9 +70,10 @@ |
303 | * QString auth [readwrite] |
304 | * The current authentication of the hotspot. The default for this property |
305 | * is "wpa-psk" and is currently the only supported scheme. WEP is unsupported |
306 | - * by design, as is no scheme at all. |
307 | - * |
308 | - * TODO: Check/add support for wpa-eap |
309 | + * by design. |
310 | + * |
311 | + * Possible authentication schemes: wpa-psk, none |
312 | + * |
313 | * |
314 | * QString password [readwrite] |
315 | * The current Pre-Shared-Key for the hotspot. If the key is 64-characters |
316 | @@ -110,6 +111,11 @@ |
317 | WRITE setMode |
318 | NOTIFY modeChanged) |
319 | |
320 | + Q_PROPERTY( QString auth |
321 | + READ auth |
322 | + WRITE setAuth |
323 | + NOTIFY authChanged) |
324 | + |
325 | Q_PROPERTY( bool stored |
326 | READ stored |
327 | NOTIFY storedChanged) |
328 | @@ -135,6 +141,8 @@ |
329 | |
330 | QString mode() const; |
331 | |
332 | + QString auth() const; |
333 | + |
334 | bool disconnectWifi() const; |
335 | |
336 | Q_SIGNALS: |
337 | @@ -148,6 +156,8 @@ |
338 | |
339 | void modeChanged(const QString& mode); |
340 | |
341 | + void authChanged(const QString& auth); |
342 | + |
343 | void disconnectWifiChanged(bool disconnect); |
344 | |
345 | /* |
346 | @@ -169,6 +179,8 @@ |
347 | |
348 | void setMode(const QString&); |
349 | |
350 | + void setAuth(const QString&); |
351 | + |
352 | private: |
353 | class Priv; |
354 | std::shared_ptr<Priv> d; |
355 | |
356 | === modified file 'src/indicator/nmofono/manager-impl.cpp' |
357 | --- src/indicator/nmofono/manager-impl.cpp 2015-08-18 08:39:29 +0000 |
358 | +++ src/indicator/nmofono/manager-impl.cpp 2015-09-09 12:18:20 +0000 |
359 | @@ -267,6 +267,7 @@ |
360 | connect(d->m_hotspotManager.get(), &HotspotManager::ssidChanged, this, &Manager::hotspotSsidChanged); |
361 | connect(d->m_hotspotManager.get(), &HotspotManager::passwordChanged, this, &Manager::hotspotPasswordChanged); |
362 | connect(d->m_hotspotManager.get(), &HotspotManager::modeChanged, this, &Manager::hotspotModeChanged); |
363 | + connect(d->m_hotspotManager.get(), &HotspotManager::authChanged, this, &Manager::hotspotAuthChanged); |
364 | connect(d->m_hotspotManager.get(), &HotspotManager::storedChanged, this, &Manager::hotspotStoredChanged); |
365 | |
366 | connect(d->m_hotspotManager.get(), &HotspotManager::reportError, this, &Manager::reportError); |
367 | @@ -627,6 +628,12 @@ |
368 | return d->m_hotspotManager->mode(); |
369 | } |
370 | |
371 | +QString |
372 | +ManagerImpl::hotspotAuth() const |
373 | +{ |
374 | + return d->m_hotspotManager->auth(); |
375 | +} |
376 | + |
377 | void |
378 | ManagerImpl::setHotspotSsid(const QByteArray& ssid) |
379 | { |
380 | @@ -645,6 +652,12 @@ |
381 | d->m_hotspotManager->setMode(mode); |
382 | } |
383 | |
384 | +void |
385 | +ManagerImpl::setHotspotAuth(const QString& auth) |
386 | +{ |
387 | + d->m_hotspotManager->setAuth(auth); |
388 | +} |
389 | + |
390 | } |
391 | |
392 | #include "manager-impl.moc" |
393 | |
394 | === modified file 'src/indicator/nmofono/manager-impl.h' |
395 | --- src/indicator/nmofono/manager-impl.h 2015-08-14 15:52:39 +0000 |
396 | +++ src/indicator/nmofono/manager-impl.h 2015-09-09 12:18:20 +0000 |
397 | @@ -81,6 +81,8 @@ |
398 | |
399 | QString hotspotMode() const override; |
400 | |
401 | + QString hotspotAuth() const override; |
402 | + |
403 | void setHotspotEnabled(bool) override; |
404 | |
405 | void setHotspotSsid(const QByteArray&) override; |
406 | @@ -89,6 +91,8 @@ |
407 | |
408 | void setHotspotMode(const QString&) override; |
409 | |
410 | + void setHotspotAuth(const QString&) override; |
411 | + |
412 | private Q_SLOTS: |
413 | void device_added(const QDBusObjectPath &path); |
414 | void device_removed(const QDBusObjectPath &path); |
415 | |
416 | === modified file 'src/indicator/nmofono/manager.h' |
417 | --- src/indicator/nmofono/manager.h 2015-08-14 15:52:39 +0000 |
418 | +++ src/indicator/nmofono/manager.h 2015-09-09 12:18:20 +0000 |
419 | @@ -137,6 +137,9 @@ |
420 | Q_PROPERTY(QString hotspotMode READ hotspotMode WRITE setHotspotMode NOTIFY hotspotModeChanged) |
421 | virtual QString hotspotMode() const = 0; |
422 | |
423 | + Q_PROPERTY(QString hotspotAuth READ hotspotAuth WRITE setHotspotAuth NOTIFY hotspotAuthChanged) |
424 | + virtual QString hotspotAuth() const = 0; |
425 | + |
426 | Q_SIGNALS: |
427 | void flightModeUpdated(bool); |
428 | |
429 | @@ -160,6 +163,8 @@ |
430 | |
431 | void hotspotModeChanged(const QString& mode); |
432 | |
433 | + void hotspotAuthChanged(const QString& auth); |
434 | + |
435 | void reportError(int reason); |
436 | |
437 | void unstoppableOperationHappeningUpdated(bool); |
438 | @@ -177,6 +182,8 @@ |
439 | |
440 | virtual void setHotspotMode(const QString&) = 0; |
441 | |
442 | + virtual void setHotspotAuth(const QString&) = 0; |
443 | + |
444 | protected: |
445 | /** |
446 | * @brief The default constructor is protected. |
447 | |
448 | === modified file 'tests/integration/test-connectivity-api.cpp' |
449 | --- tests/integration/test-connectivity-api.cpp 2015-08-17 15:38:34 +0000 |
450 | +++ tests/integration/test-connectivity-api.cpp 2015-09-09 12:18:20 +0000 |
451 | @@ -504,6 +504,7 @@ |
452 | QSignalSpy passwordSpy(connectivity.get(), SIGNAL(hotspotPasswordUpdated(const QString&))); |
453 | |
454 | EXPECT_EQ("Ubuntu", connectivity->hotspotSsid().toStdString()); |
455 | + EXPECT_EQ("wpa-psk", connectivity->hotspotAuth().toStdString()); |
456 | EXPECT_FALSE(connectivity->hotspotStored()); |
457 | EXPECT_FALSE(connectivity->hotspotEnabled()); |
458 | |
459 | @@ -630,4 +631,95 @@ |
460 | } |
461 | } |
462 | |
463 | +TEST_F(TestConnectivityApi, InsecureHotspotConfig) |
464 | +{ |
465 | + // Start the indicator |
466 | + ASSERT_NO_THROW(startIndicator()); |
467 | + auto& nmSettingsMock = dbusMock.mockInterface(NM_DBUS_SERVICE, |
468 | + NM_DBUS_PATH_SETTINGS, |
469 | + NM_DBUS_IFACE_SETTINGS, |
470 | + QDBusConnection::SystemBus); |
471 | + QSignalSpy nmSettingsMockCallSpy( |
472 | + &nmSettingsMock, |
473 | + SIGNAL(MethodCalled(const QString &, const QVariantList &))); |
474 | + |
475 | + OrgFreedesktopNetworkManagerSettingsInterface settings( |
476 | + NM_DBUS_SERVICE, NM_DBUS_PATH_SETTINGS, dbusTestRunner.systemConnection()); |
477 | + QSignalSpy settingsNewConnectionSpy( |
478 | + &settings, |
479 | + SIGNAL(NewConnection(const QDBusObjectPath &))); |
480 | + |
481 | + // Connect the the service |
482 | + auto connectivity(newConnectivity()); |
483 | + |
484 | + QSignalSpy storedSpy(connectivity.get(), SIGNAL(hotspotStoredUpdated(bool))); |
485 | + QSignalSpy enabledSpy(connectivity.get(), SIGNAL(hotspotEnabledUpdated(bool))); |
486 | + QSignalSpy authSpy(connectivity.get(), SIGNAL(hotspotAuthUpdated(const QString&))); |
487 | + |
488 | + EXPECT_EQ("Ubuntu", connectivity->hotspotSsid().toStdString()); |
489 | + EXPECT_EQ("wpa-psk", connectivity->hotspotAuth().toStdString()); |
490 | + EXPECT_FALSE(connectivity->hotspotStored()); |
491 | + EXPECT_FALSE(connectivity->hotspotEnabled()); |
492 | + |
493 | + connectivity->setHotspotAuth("none"); |
494 | + |
495 | + if (authSpy.empty()) |
496 | + { |
497 | + ASSERT_TRUE(authSpy.wait()); |
498 | + } |
499 | + EXPECT_FALSE(authSpy.empty()); |
500 | + EXPECT_EQ("none", connectivity->hotspotAuth().toStdString()); |
501 | + |
502 | + connectivity->setHotspotEnabled(true); |
503 | + |
504 | + if (enabledSpy.empty()) |
505 | + { |
506 | + ASSERT_TRUE(enabledSpy.wait()); |
507 | + } |
508 | + EXPECT_FALSE(enabledSpy.empty()); |
509 | + |
510 | + if (storedSpy.empty()) |
511 | + { |
512 | + ASSERT_TRUE(storedSpy.wait()); |
513 | + } |
514 | + EXPECT_FALSE(storedSpy.empty()); |
515 | + |
516 | + if (nmSettingsMockCallSpy.empty()) |
517 | + { |
518 | + ASSERT_TRUE(nmSettingsMockCallSpy.wait()); |
519 | + } |
520 | + EXPECT_FALSE(nmSettingsMockCallSpy.empty()); |
521 | + |
522 | + if (settingsNewConnectionSpy.empty()) |
523 | + { |
524 | + ASSERT_TRUE(settingsNewConnectionSpy.wait()); |
525 | + } |
526 | + EXPECT_FALSE(settingsNewConnectionSpy.empty()); |
527 | + |
528 | + EXPECT_TRUE(connectivity->hotspotEnabled()); |
529 | + EXPECT_TRUE(connectivity->hotspotStored()); |
530 | + |
531 | + // Connect to method calls on the newly added connection |
532 | + auto connectionPath = qvariant_cast<QDBusObjectPath>(settingsNewConnectionSpy.first().first()); |
533 | + auto& connectionSettingsMock = dbusMock.mockInterface(NM_DBUS_SERVICE, connectionPath.path(), |
534 | + NM_DBUS_IFACE_SETTINGS_CONNECTION, |
535 | + QDBusConnection::SystemBus); |
536 | + QSignalSpy connectionSettingsMockCallSpy( |
537 | + &connectionSettingsMock, |
538 | + SIGNAL(MethodCalled(const QString &, const QVariantList &))); |
539 | + |
540 | + { |
541 | + auto call = getMethodCall(nmSettingsMockCallSpy, "AddConnection"); |
542 | + // Decode the QDBusArgument |
543 | + QVariantDictMap connection; |
544 | + qvariant_cast<QDBusArgument>(call.first()) >> connection; |
545 | + EXPECT_EQ(QVariantMap({ |
546 | + {"mode", "ap"}, |
547 | + {"ssid", "Ubuntu"} |
548 | + }), connection["802-11-wireless"]); |
549 | + EXPECT_EQ(QVariantMap(), connection["802-11-wireless-security"]); |
550 | + EXPECT_TRUE(connection["connection"]["autoconnect"].toBool()); |
551 | + } |
552 | +} |
553 | + |
554 | } |
PASSED: Continuous integration, rev:523 jenkins. qa.ubuntu. com/job/ indicator- network- ci/387/ jenkins. qa.ubuntu. com/job/ indicator- network- wily-amd64- ci/39 jenkins. qa.ubuntu. com/job/ indicator- network- wily-armhf- ci/39 jenkins. qa.ubuntu. com/job/ indicator- network- wily-armhf- ci/39/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- network- ci/387/ rebuild
http://