Merge lp:~jonas-drange/ubuntu-system-settings/add-usc-test-dep into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Superseded
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/add-usc-test-dep
Merge into: lp:ubuntu-system-settings
Diff against target: 498 lines (+102/-151)
9 files modified
debian/control (+4/-3)
plugins/wifi/CMakeLists.txt (+0/-1)
plugins/wifi/CertDialog.qml (+37/-10)
plugins/wifi/CertPicker.qml (+0/-58)
plugins/wifi/OtherNetwork.qml (+34/-12)
plugins/wifi/certhandler.cpp (+24/-22)
plugins/wifi/certhandler.h (+3/-4)
tests/autopilot/ubuntu_system_settings/__init__.py (+0/-32)
tests/autopilot/ubuntu_system_settings/tests/test_vpn.py (+0/-9)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/add-usc-test-dep
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
Ubuntu Touch System Settings Pending
Review via email: mp+308771@code.launchpad.net

This proposal has been superseded by a proposal from 2016-10-19.

Commit message

adds test dep on usc

To post a comment you must log in.
1660. By Jonas G. Drange

add usc test dep

1661. By Jonas G. Drange

be specific of version in usc test dep

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1729
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/215/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1866/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1867
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1707
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1707/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/215/rebuild

review: Needs Fixing (continuous-integration)
1662. By Jonas G. Drange

merge prereq

1663. By Jonas G. Drange

bump test dep

Unmerged revisions

1663. By Jonas G. Drange

bump test dep

1662. By Jonas G. Drange

merge prereq

1661. By Jonas G. Drange

be specific of version in usc test dep

1660. By Jonas G. Drange

add usc test dep

1659. By Jonas G. Drange

apply filepicker patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-09-30 13:48:06 +0000
3+++ debian/control 2016-10-19 07:36:02 +0000
4@@ -45,7 +45,8 @@
5 dpkg-dev,
6 qml-module-qttest,
7 qml-module-qtquick2,
8- qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
9+ qml-module-ubuntu-components | qml-module-ubuntu-components-gles,
10+ qtdeclarative5-ubuntu-settings-components,
11 libubuntuoneauth-2.0-dev,
12 libqtdbusmock1-dev (>= 0.2+14.04.20140724),
13 libqtdbustest1-dev,
14@@ -95,8 +96,8 @@
15 qml-module-ofono (>=0.90~),
16 qml-module-qtsysteminfo,
17 qtdeclarative5-ubuntu-content1,
18- qtdeclarative5-ubuntu-settings-components (>= 0.8),
19- qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3.1584) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3.1584),
20+ qtdeclarative5-ubuntu-settings-components (>= 0.9),
21+ qml-module-ubuntu-components (>= 1.3.1584) | qml-module-ubuntu-components-gles (>= 1.3.1584),
22 suru-icon-theme (>= 14.04+15.04.20150813~),
23 whoopsie-preferences (>= 0.9),
24 libsystemsettings1 (= ${binary:Version}),
25
26=== modified file 'plugins/wifi/CMakeLists.txt'
27--- plugins/wifi/CMakeLists.txt 2016-08-16 23:50:33 +0000
28+++ plugins/wifi/CMakeLists.txt 2016-10-19 07:36:02 +0000
29@@ -1,7 +1,6 @@
30 set(QML_SOURCES
31 AccessPoint.qml
32 BaseMenuItem.qml
33-CertPicker.qml
34 CertDialog.qml
35 Common.qml
36 DivMenuItem.qml
37
38=== modified file 'plugins/wifi/CertDialog.qml'
39--- plugins/wifi/CertDialog.qml 2015-08-10 13:31:45 +0000
40+++ plugins/wifi/CertDialog.qml 2016-10-19 07:36:02 +0000
41@@ -27,6 +27,30 @@
42 }
43 }
44
45+ Component {
46+ id: failedToImportComponent
47+ Dialog {
48+ id: failedToImportDialog
49+ title: {
50+ if (certType === 0) { // certificate
51+ return i18n.tr("Could not save certificate.")
52+ } else if (certType === 1) { // privatekey
53+ return i18n.tr("Could not save key.")
54+ } else if (certType === 2) { // pacFile
55+ return i18n.tr("Could not save pack file.")
56+ }
57+ }
58+
59+ Button {
60+ text: i18n.tr("OK")
61+ onClicked: {
62+ PopupUtils.close(failedToImportDialog);
63+ PopupUtils.close(certDialog);
64+ }
65+ }
66+ }
67+ }
68+
69 FileHandler {
70 id: fileHandler
71 }
72@@ -64,7 +88,6 @@
73 Layout.fillWidth: true
74 text: i18n.tr("Cancel")
75 onClicked: {
76- fileHandler.removeFile(certDialog.fileName);
77 PopupUtils.close(certDialog);
78 }
79 }
80@@ -74,19 +97,23 @@
81 text: i18n.tr("Save")
82 Layout.fillWidth: true
83 enabled: (certDialog.certContent.text !== "")
84- onClicked: { if (certType === 0) { // certificate
85- fileHandler.moveCertFile(certDialog.fileName);
86+ onClicked: {
87+ var ret;
88+ if (certType === 0) { // certificate
89+ ret = fileHandler.copyCertFile(certDialog.fileName);
90 } else if (certType === 1) { // privatekey
91- fileHandler.moveKeyFile(certDialog.fileName);
92+ ret = fileHandler.copyKeyFile(certDialog.fileName);
93 } else if (certType === 2) { // pacFile
94- fileHandler.movePacFile(certDialog.fileName);
95+ ret = fileHandler.copyPacFile(certDialog.fileName);
96 }
97
98- /* Just to be sure source file will be deleted if move was
99- not successfull */
100- fileHandler.removeFile(certDialog.fileName);
101- certDialog.updateSignal(true);
102- PopupUtils.close(certDialog);
103+ // If the cert/key/pac doesn't compute, warn.
104+ if (!ret) {
105+ PopupUtils.open(failedToImportComponent);
106+ } else {
107+ certDialog.updateSignal(true);
108+ PopupUtils.close(certDialog);
109+ }
110 }
111 }
112 }
113
114=== removed file 'plugins/wifi/CertPicker.qml'
115--- plugins/wifi/CertPicker.qml 2016-03-16 16:26:18 +0000
116+++ plugins/wifi/CertPicker.qml 1970-01-01 00:00:00 +0000
117@@ -1,58 +0,0 @@
118-import QtQuick 2.4
119-import QtQuick.Layouts 1.1
120-import Ubuntu.Components 1.3
121-import Ubuntu.Components.Popups 1.3
122-import Ubuntu.Content 1.3
123-
124-PopupBase {
125- id: picker
126-
127- signal fileImportSignal (var file)
128- property var activeTransfer
129-
130- Rectangle {
131- anchors.fill: parent
132-
133- ContentTransferHint {
134- id: transferHint
135- anchors.fill: parent
136- activeTransfer: picker.activeTransfer
137- }
138-
139- ContentStore {
140- id: appStore
141- scope: ContentScope.App
142- }
143-
144- ContentPeerPicker {
145- id: peerPicker
146- anchors.fill: parent
147- visible: true
148- contentType: ContentType.Documents
149- handler: ContentHandler.Source
150- onPeerSelected: {
151- peer.selectionType = ContentTransfer.Single;
152- picker.activeTransfer = peer.request(appStore);
153- }
154- onCancelPressed: PopupUtils.close(picker)
155- }
156- }
157-
158- Connections {
159- target: picker.activeTransfer ? picker.activeTransfer : null
160- onStateChanged: {
161- if (picker.activeTransfer.state === ContentTransfer.Charged) {
162- if (picker.activeTransfer.items.length > 0) {
163- var fileUrl = picker.activeTransfer.items[0].url;
164- picker.fileImportSignal(
165- fileUrl.toString().replace("file://", "")
166- );
167- PopupUtils.close(picker);
168- }
169- } else if (picker.activeTransfer.state === ContentTransfer.Aborted){
170- picker.fileImportSignal(false);
171- PopupUtils.close(picker);
172- }
173- }
174- }
175-}
176
177=== modified file 'plugins/wifi/OtherNetwork.qml'
178--- plugins/wifi/OtherNetwork.qml 2016-08-17 11:26:03 +0000
179+++ plugins/wifi/OtherNetwork.qml 2016-10-19 07:36:02 +0000
180@@ -20,18 +20,25 @@
181 import Ubuntu.Components 1.3
182 import Ubuntu.Components.ListItems 1.3 as ListItems
183 import Ubuntu.Components.Popups 1.3
184+import Ubuntu.Settings.Components 0.1
185 import Ubuntu.SystemSettings.Wifi 1.0
186
187 Component {
188
189 Dialog {
190
191+ Component {
192+ id: filePickerComponent
193+ FilePicker {}
194+ }
195+
196 id: otherNetworkDialog
197 objectName: "otherNetworkDialog"
198 anchorToKeyboard: true
199
200 property string ssid
201 property string bssid
202+ property string keyMgmt
203
204 function settingsValid () {
205 if (networkname.length === 0) {
206@@ -59,11 +66,10 @@
207 var pickerDialog;
208 var certDialog;
209
210- pickerDialog = PopupUtils.open(
211- Qt.resolvedUrl("./CertPicker.qml")
212- );
213- pickerDialog.fileImportSignal.connect(function (file) {
214- if (!file === false) {
215+ pickerDialog = PopupUtils.open(filePickerComponent);
216+ pickerDialog.accept.connect(function (file) {
217+ PopupUtils.close(pickerDialog);
218+ if (file) {
219 certDialogLoader.source = Qt.resolvedUrl(
220 "./CertDialog.qml"
221 );
222@@ -84,12 +90,13 @@
223 });
224 }
225 });
226+ pickerDialog.reject.connect(function () {
227+ PopupUtils.close(pickerDialog);
228+ });
229 }
230
231 title: ssid ?
232- /* TODO(jgdx): Hack to avoid breaking string freeze. This will be
233- changed to i18n.tr("Connect to %1").arg(ssid) per spec. */
234- i18n.tr("Connect to Wi‑Fi") + " " + ssid :
235+ i18n.tr("Connect to %1").arg(ssid) :
236 i18n.tr("Connect to Hidden Network")
237 text: feedback.enabled ? feedback.text : "";
238
239@@ -322,7 +329,22 @@
240 i18n.tr("Dynamic WEP (802.1x)"), // index: 4
241 i18n.tr("LEAP"), // index: 5
242 ]
243- selectedIndex: 1
244+ selectedIndex: {
245+ switch(keyMgmt) {
246+ case 'none': // WEP
247+ return 0;
248+ case 'wpa-eap': // WPA-Enterprise
249+ return 2;
250+ case 'wep': // WEP
251+ return 3;
252+ case 'ieee8021x': // Dynamic WEP
253+ return 4;
254+ case 'wpa-none': // Ad-Hoc WPA-PSK
255+ case 'wpa-psk': // infrastructure WPA-PSK
256+ default: // Default is WPA
257+ return 1;
258+ }
259+ }
260 }
261
262 Label {
263@@ -357,7 +379,6 @@
264 visible: securityList.selectedIndex === 2 ||
265 securityList.selectedIndex === 4
266 }
267-
268 Label {
269 id: p2authListLabel
270 text : i18n.tr("Inner authentication")
271@@ -791,7 +812,7 @@
272 font.bold: false
273 color: Theme.palette.normal.baseText
274 elide: Text.ElideRight
275- visible: securityList.selectedIndex !== 0
276+ visible: password.visible
277 }
278
279 TextField {
280@@ -799,6 +820,7 @@
281 objectName: "password"
282 width: parent.width
283 visible: securityList.selectedIndex !== 0
284+
285 echoMode: passwordVisibleSwitch.checked ?
286 TextInput.Normal : TextInput.Password
287 inputMethodHints: Qt.ImhNoPredictiveText
288@@ -809,7 +831,7 @@
289 id: passwordVisiblityRow
290 layoutDirection: Qt.LeftToRight
291 spacing: units.gu(2)
292- visible: securityList.selectedIndex !== 0
293+ visible: password.visible
294
295 CheckBox {
296 id: passwordVisibleSwitch
297
298=== modified file 'plugins/wifi/certhandler.cpp'
299--- plugins/wifi/certhandler.cpp 2015-06-15 19:28:23 +0000
300+++ plugins/wifi/certhandler.cpp 2016-10-19 07:36:02 +0000
301@@ -32,19 +32,19 @@
302 }
303 }
304
305-QString FileHandler::moveCertFile(QString filename){
306+QString FileHandler::copyCertFile(QString filename){
307 QDir certPath(CERTS_PATH);
308 if (!certPath.exists(CERTS_PATH)){
309 certPath.mkpath(CERTS_PATH);
310 }
311- QFile file(filename);
312 QByteArray certificate = getCertContent(filename);
313 QList<QSslCertificate> SslCertificateList = QSslCertificate::fromData(certificate, QSsl::Pem);
314 if ( !SslCertificateList.isEmpty() ){
315 QStringList subject = SslCertificateList[0].subjectInfo(QSslCertificate::CommonName);
316 QString modFileName = CERTS_PATH+subject[0]+".pem";
317- if(file.rename(modFileName.replace(" ", "_"))){
318- return file.fileName();
319+ modFileName = modFileName.replace(" ", "_");
320+ if(QFile::copy(filename, modFileName)){
321+ return modFileName;
322 } else {
323 return "";
324 }
325@@ -52,7 +52,7 @@
326 return "";
327 }
328
329-QString FileHandler::moveKeyFile(QString filename){
330+QString FileHandler::copyKeyFile(QString filename){
331 QDir keyPath(KEYS_PATH);
332 if (!keyPath.exists(KEYS_PATH)){
333 keyPath.mkpath(KEYS_PATH);
334@@ -64,8 +64,8 @@
335 if ( !checkKey.isNull() ){
336 QFileInfo fileInfo(file);
337 QString modFileName = KEYS_PATH + fileInfo.fileName().replace(" ", "_");
338- if(file.rename(modFileName)){
339- return file.fileName();
340+ if(QFile::copy(filename, modFileName)){
341+ return modFileName;
342 } else {
343 return "" ;
344 }
345@@ -73,7 +73,7 @@
346 return "";
347 }
348
349-QString FileHandler::movePacFile(QString filename){
350+QString FileHandler::copyPacFile(QString filename){
351 QDir keyPath(PACS_PATH);
352 if (!keyPath.exists(PACS_PATH)){
353 keyPath.mkpath(PACS_PATH);
354@@ -81,17 +81,12 @@
355 QFile file(filename);
356 QFileInfo fileInfo(file);
357 QString modFileName = PACS_PATH + fileInfo.baseName().replace(" ", "_") + ".pac";
358- if(file.rename(modFileName)){
359- return file.fileName();
360+ if(QFile::copy(filename, modFileName)){
361+ return modFileName;
362 }
363 return "" ;
364 }
365
366-bool FileHandler::removeFile(QString filename){
367- QFile file(filename);
368- return file.remove();
369-}
370-
371 struct CertificateListModel::Private {
372 QStringList data;
373 };
374@@ -144,8 +139,9 @@
375 }
376
377 QVariant CertificateListModel::data(const QModelIndex &index, int role) const {
378+ QVariant rv;
379 if(!index.isValid() || index.row() >= ( p->data.size()) ) {
380- return QVariant();
381+ return rv;
382 } else if (index.row() == 0){
383 const QString &row0 = p->data[index.row()];
384
385@@ -168,13 +164,19 @@
386 const QString &row = CERTS_PATH+p->data[index.row()];
387 QList<QSslCertificate> certificate = QSslCertificate::fromPath(row, QSsl::Pem, QRegExp::Wildcard);
388
389+ if (certificate.size() == 0) {
390+ return rv;
391+ }
392+
393 switch(role) {
394-
395- case CNRole : return certificate[0].subjectInfo(QSslCertificate::CommonName)[0];
396- case ORole : return certificate[0].subjectInfo(QSslCertificate::Organization)[0];
397- case expDateRole : return certificate[0].expiryDate().toString("dd.MM.yyyy");
398-
399- default : return QVariant();
400+ case CNRole:
401+ return certificate[0].subjectInfo(QSslCertificate::CommonName).value(0, "");
402+ case ORole:
403+ return certificate[0].subjectInfo(QSslCertificate::Organization).value(0, "");
404+ case expDateRole:
405+ return certificate[0].expiryDate().toString("dd.MM.yyyy");
406+ default:
407+ return rv;
408 }
409 }
410
411
412=== modified file 'plugins/wifi/certhandler.h'
413--- plugins/wifi/certhandler.h 2015-06-03 19:35:09 +0000
414+++ plugins/wifi/certhandler.h 2016-10-19 07:36:02 +0000
415@@ -11,10 +11,9 @@
416 Q_OBJECT
417 public:
418 Q_INVOKABLE QByteArray getCertContent(QString filename);
419- Q_INVOKABLE QString moveCertFile(QString filename);
420- Q_INVOKABLE QString moveKeyFile(QString filename);
421- Q_INVOKABLE QString movePacFile(QString filename);
422- Q_INVOKABLE bool removeFile(QString filename);
423+ Q_INVOKABLE QString copyCertFile(QString filename);
424+ Q_INVOKABLE QString copyKeyFile(QString filename);
425+ Q_INVOKABLE QString copyPacFile(QString filename);
426 };
427
428
429
430=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
431--- tests/autopilot/ubuntu_system_settings/__init__.py 2016-08-19 12:49:41 +0000
432+++ tests/autopilot/ubuntu_system_settings/__init__.py 2016-10-19 07:36:02 +0000
433@@ -1754,38 +1754,6 @@
434 self._openvpn_port_field.write(port)
435
436 @autopilot.logging.log_action(logger.debug)
437- def set_openvpn_ca(self, paths):
438- self.set_openvpn_file(self._openvpn_ca_field, paths)
439-
440- @autopilot.logging.log_action(logger.debug)
441- def set_openvpn_file(self, field, paths):
442- utils.dismiss_osk()
443- self.get_root_instance().main_view.scroll_to_and_click(field)
444-
445- # Wait for expanded animation.
446- sleep(0.5)
447-
448- # file = field.wait_select_single(objectName='vpnFileSelectorItem0')
449- choose = field.wait_select_single(objectName='vpnFileSelectorItem1')
450- self.pointing_device.click_object(choose)
451- self.get_root_instance().main_view.scroll_to_and_click(choose)
452- file_dialog = self.get_root_instance().wait_select_single(
453- objectName='vpnDialogFile'
454- )
455-
456- # Go to root /
457- root = file_dialog.wait_select_single(objectName='vpnFilePathItem_/')
458- self.pointing_device.click_object(root)
459-
460- for path in paths:
461- list_view = file_dialog.wait_select_single(
462- 'QQuickListView', objectName='vpnFileList'
463- )
464- list_view.click_element('vpnFileItem_%s' % path)
465- accept = file_dialog.wait_select_single(objectName='vpnFileAccept')
466- self.pointing_device.click_object(accept)
467-
468- @autopilot.logging.log_action(logger.debug)
469 def openvpn_okay(self):
470 utils.dismiss_osk()
471 self.get_root_instance().main_view.scroll_to_and_click(
472
473=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_vpn.py'
474--- tests/autopilot/ubuntu_system_settings/tests/test_vpn.py 2016-03-09 14:03:57 +0000
475+++ tests/autopilot/ubuntu_system_settings/tests/test_vpn.py 2016-10-19 07:36:02 +0000
476@@ -35,10 +35,6 @@
477 page.set_openvpn_server('vpn.ubuntu.com')
478 page.set_openvpn_custom_port('1000')
479
480- page.set_openvpn_ca(
481- # Any file will do.
482- ['etc', 'apt', 'sources.list']
483- )
484 page.openvpn_okay()
485
486 self.assertThat(
487@@ -47,11 +43,6 @@
488 )
489
490 self.assertThat(
491- lambda: conn_obj.Get(VPN_CONN_OPENVPN_IFACE, 'ca'),
492- Eventually(Equals('/etc/apt/sources.list'))
493- )
494-
495- self.assertThat(
496 lambda: conn_obj.Get(VPN_CONN_OPENVPN_IFACE, 'portSet'),
497 Eventually(Equals(True))
498 )

Subscribers

People subscribed via source and target branches