Merge lp:~mardy/uoa-integration-tests/password-plugin into lp:uoa-integration-tests

Proposed by Alberto Mardegan
Status: Merged
Approved by: Ken VanDine
Approved revision: 13
Merged at revision: 12
Proposed branch: lp:~mardy/uoa-integration-tests/password-plugin
Merge into: lp:uoa-integration-tests
Diff against target: 202 lines (+167/-1)
5 files modified
data/test-login-photos.service (+6/-0)
data/test-login.provider (+14/-0)
qml/test-login/Main.qml (+35/-0)
qml/test-login/NewAccount.qml (+103/-0)
setup.py (+9/-1)
To merge this branch: bzr merge lp:~mardy/uoa-integration-tests/password-plugin
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+193228@code.launchpad.net

Commit message

Add an account plugin to test a form-based authentication (username/password).

Description of the change

Add an account plugin to test a form-based authentication (username/password).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/test-login-photos.service'
2--- data/test-login-photos.service 1970-01-01 00:00:00 +0000
3+++ data/test-login-photos.service 2013-10-30 12:34:48 +0000
4@@ -0,0 +1,6 @@
5+<?xml version="1.0" encoding="UTF-8"?>
6+<service id="test-login-photos">
7+ <type>test-photos</type>
8+ <name>TestLogin Photos</name>
9+ <provider>test-login</provider>
10+</service>
11
12=== added file 'data/test-login.provider'
13--- data/test-login.provider 1970-01-01 00:00:00 +0000
14+++ data/test-login.provider 2013-10-30 12:34:48 +0000
15@@ -0,0 +1,14 @@
16+<?xml version="1.0" encoding="UTF-8"?>
17+<provider id="test-login">
18+ <name>TestLogin</name>
19+ <icon>test-login</icon>
20+ <translations>account-plugins</translations>
21+ <domains>.*example\.com</domains>
22+
23+ <template>
24+ <group name="auth">
25+ <setting name="method">password</setting>
26+ <setting name="mechanism">password</setting>
27+ </group>
28+ </template>
29+</provider>
30
31=== added directory 'qml/test-login'
32=== added file 'qml/test-login/Main.qml'
33--- qml/test-login/Main.qml 1970-01-01 00:00:00 +0000
34+++ qml/test-login/Main.qml 2013-10-30 12:34:48 +0000
35@@ -0,0 +1,35 @@
36+import QtQuick 2.0
37+import Ubuntu.Components 0.1
38+import Ubuntu.OnlineAccounts.Plugin 1.0
39+
40+Flickable {
41+ id: rootFlickable
42+
43+ property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
44+ contentHeight: editPageLoader.item.height + keyboardSize
45+
46+ signal finished
47+
48+ Loader {
49+ id: editPageLoader
50+ anchors.left: parent.left
51+ anchors.right: parent.right
52+ anchors.top: parent.top
53+ sourceComponent: account.accountId != 0 ? existingAccountComponent : newAccountComponent
54+
55+ Connections {
56+ target: editPageLoader.item
57+ onFinished: rootFlickable.finished()
58+ }
59+ }
60+
61+ Component {
62+ id: newAccountComponent
63+ NewAccount {}
64+ }
65+
66+ Component {
67+ id: existingAccountComponent
68+ Options {}
69+ }
70+}
71
72=== added file 'qml/test-login/NewAccount.qml'
73--- qml/test-login/NewAccount.qml 1970-01-01 00:00:00 +0000
74+++ qml/test-login/NewAccount.qml 2013-10-30 12:34:48 +0000
75@@ -0,0 +1,103 @@
76+import QtQuick 2.0
77+import Ubuntu.Components 0.1
78+import Ubuntu.OnlineAccounts 0.1
79+
80+Column {
81+ id: root
82+
83+ property variant __account: account
84+
85+ signal finished
86+
87+ anchors.margins: units.gu(1)
88+ spacing: units.gu(2)
89+
90+ Label {
91+ text: "Username:"
92+
93+ anchors.left: parent.left
94+ anchors.right: parent.right
95+ anchors.margins: parent.anchors.margins
96+ }
97+
98+ TextField {
99+ id: usernameField
100+ objectName: "usernameField"
101+ placeholderText: "Your username"
102+ width: root.width - (2 * root.anchors.margins)
103+ anchors.left: parent.left
104+ anchors.margins: parent.anchors.margins
105+ focus: true
106+ KeyNavigation.tab: passwordField
107+ }
108+
109+ Label {
110+ text: "Password:"
111+ }
112+
113+ TextField {
114+ id: passwordField
115+ objectName: "passwordField"
116+ placeholderText: "Your password"
117+ echoMode: TextInput.Password
118+ width: root.width - (2 * root.anchors.margins)
119+
120+ inputMethodHints: Qt.ImhSensitiveData
121+ }
122+
123+ Row {
124+ id: buttons
125+ height: units.gu(5)
126+ anchors.left: parent.left
127+ anchors.right: parent.right
128+ spacing: units.gu(1)
129+ Button {
130+ id: btnCancel
131+ objectName: "cancelButton"
132+ text: "Cancel"
133+ color: "#1c091a"
134+ height: parent.height
135+ width: (parent.width / 2) - 0.5 * parent.spacing
136+ onClicked: finished()
137+ }
138+ Button {
139+ id: btnContinue
140+ objectName: "continueButton"
141+ text: "Continue"
142+ color: "#cc3300"
143+ height: parent.height
144+ width: (parent.width / 2) - 0.5 * parent.spacing
145+ onClicked: {
146+ account.updateDisplayName(usernameField.text)
147+ creds.userName = usernameField.text
148+ creds.secret = passwordField.text
149+ creds.sync()
150+ }
151+ }
152+ }
153+
154+ Credentials {
155+ id: creds
156+ caption: account.provider.id
157+ acl: ["unconfined"]
158+ storeSecret: true
159+ onCredentialsIdChanged: root.credentialsStored()
160+ }
161+
162+ AccountService {
163+ id: globalAccountSettings
164+ objectHandle: account.accountServiceHandle
165+ autoSync: false
166+ }
167+
168+ function credentialsStored() {
169+ console.log("Credentials stored, id: " + creds.credentialsId)
170+ if (creds.credentialsId == 0) return
171+
172+ globalAccountSettings.updateServiceEnabled(true)
173+ globalAccountSettings.credentials = creds
174+ account.synced.connect(finished)
175+ account.sync()
176+ }
177+
178+}
179
180=== modified file 'setup.py'
181--- setup.py 2013-09-27 10:58:24 +0000
182+++ setup.py 2013-10-30 12:34:48 +0000
183@@ -13,10 +13,18 @@
184 ('share/accounts/providers', [
185 'data/fake-oauth.provider',
186 'data/fake-oauth1.provider',
187+ 'data/test-login.provider',
188 ]),
189 ('share/accounts/qml-plugins/fake-oauth', ['qml/fake-oauth/Main.qml']),
190 ('share/accounts/qml-plugins/fake-oauth1', ['qml/fake-oauth1/Main.qml']),
191- ('share/accounts/services', ['data/fake-service.service']),
192+ ('share/accounts/qml-plugins/test-login', [
193+ 'qml/test-login/Main.qml',
194+ 'qml/test-login/NewAccount.qml',
195+ ]),
196+ ('share/accounts/services', [
197+ 'data/fake-service.service',
198+ 'data/test-login-photos.service',
199+ ]),
200 ('share/accounts/applications', ['data/uoa-integration-tests.application']),
201 ('/etc/ssl/certs', ['data/uoa-test-server.pem']),
202 ('/etc/signon-ui/webkit-options.d', ['data/localhost.conf']),

Subscribers

People subscribed via source and target branches