Merge lp:~mardy/online-accounts-api/password-1628473 into lp:online-accounts-api

Proposed by Alberto Mardegan
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 28
Merged at revision: 32
Proposed branch: lp:~mardy/online-accounts-api/password-1628473
Merge into: lp:online-accounts-api
Diff against target: 435 lines (+131/-42)
7 files modified
src/lib/OnlineAccountsDaemon/authenticator.cpp (+37/-3)
src/lib/OnlineAccountsDaemon/authenticator.h (+2/-0)
src/lib/OnlineAccountsDaemon/manager.cpp (+2/-21)
tests/daemon/functional_tests/data/com.ubuntu.tests_coolshare.service (+7/-0)
tests/daemon/functional_tests/fake_signond.h (+4/-0)
tests/daemon/functional_tests/functional_tests.cpp (+69/-16)
tests/daemon/functional_tests/signond.py (+10/-2)
To merge this branch: bzr merge lp:~mardy/online-accounts-api/password-1628473
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+307026@code.launchpad.net

Commit message

Fix reply of password-based authentication

The keys for the username and password are different from those used by signond, and need to be translated.

Description of the change

Fix reply of password-based authentication

The keys for the username and password are different from those used by signond, and need to be translated.

To post a comment you must log in.
28. By Alberto Mardegan

From trunk

* debian/control:
  - Depend on qttools5-dev-tools for qdoc (LP: #1608814)
* debian/rules:
  - No need to invoke dh_python

Revision history for this message
David Barth (dbarth) wrote :

LGTM. Nice code reorg as well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/lib/OnlineAccountsDaemon/authenticator.cpp'
--- src/lib/OnlineAccountsDaemon/authenticator.cpp 2016-02-12 07:44:03 +0000
+++ src/lib/OnlineAccountsDaemon/authenticator.cpp 2016-10-06 06:56:41 +0000
@@ -71,6 +71,7 @@
71 SignOn::AuthSession *m_authSession;71 SignOn::AuthSession *m_authSession;
72 SignOn::Identity *m_identity;72 SignOn::Identity *m_identity;
73 QVariantMap m_parameters;73 QVariantMap m_parameters;
74 int m_authMethod;
74 QVariantMap m_reply;75 QVariantMap m_reply;
75 QVariantMap m_extraReplyData;76 QVariantMap m_extraReplyData;
76 QString m_errorName;77 QString m_errorName;
@@ -85,6 +86,7 @@
85 QObject(q),86 QObject(q),
86 m_authSession(0),87 m_authSession(0),
87 m_identity(0),88 m_identity(0),
89 m_authMethod(ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN),
88 m_invalidateCache(false),90 m_invalidateCache(false),
89 q_ptr(q)91 q_ptr(q)
90{92{
@@ -111,11 +113,14 @@
111 mergeMaps(authData.parameters(), mergeMaps(parameters, m_parameters));113 mergeMaps(authData.parameters(), mergeMaps(parameters, m_parameters));
112 QString mechanism = authData.mechanism();114 QString mechanism = authData.mechanism();
113115
116 m_authMethod = Authenticator::authMethod(authData);
117
114 if (m_invalidateCache) {118 if (m_invalidateCache) {
115 /* This works for OAuth 1.0 and 2.0; other authentication plugins should119 /* This works for OAuth 1.0 and 2.0; other authentication plugins should
116 * implement a similar flag. */120 * implement a similar flag. */
117 allSessionData["ForceTokenRefresh"] = true;121 allSessionData["ForceTokenRefresh"] = true;
118 if (authData.method() == "password" || authData.method() == "sasl") {122 if (m_authMethod == ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD ||
123 m_authMethod == ONLINE_ACCOUNTS_AUTH_METHOD_SASL) {
119 uint uiPolicy = allSessionData.value("UiPolicy").toUInt();124 uint uiPolicy = allSessionData.value("UiPolicy").toUInt();
120 if (uiPolicy != SignOn::NoUserInteractionPolicy) {125 if (uiPolicy != SignOn::NoUserInteractionPolicy) {
121 allSessionData["UiPolicy"] = SignOn::RequestPasswordPolicy;126 allSessionData["UiPolicy"] = SignOn::RequestPasswordPolicy;
@@ -124,7 +129,7 @@
124 }129 }
125130
126 m_extraReplyData.clear();131 m_extraReplyData.clear();
127 if (mechanism == "HMAC-SHA1" || mechanism == "PLAINTEXT") {132 if (m_authMethod == ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1) {
128 /* For OAuth 1.0, let's return also the Consumer key and secret along133 /* For OAuth 1.0, let's return also the Consumer key and secret along
129 * with the reply. */134 * with the reply. */
130 m_extraReplyData[ONLINE_ACCOUNTS_AUTH_KEY_CONSUMER_KEY] =135 m_extraReplyData[ONLINE_ACCOUNTS_AUTH_KEY_CONSUMER_KEY] =
@@ -139,7 +144,17 @@
139void AuthenticatorPrivate::onAuthSessionResponse(const SignOn::SessionData &sessionData)144void AuthenticatorPrivate::onAuthSessionResponse(const SignOn::SessionData &sessionData)
140{145{
141 Q_Q(Authenticator);146 Q_Q(Authenticator);
142 m_reply = mergeMaps(m_extraReplyData, sessionData.toMap());147 QVariantMap signonReply;
148
149 /* Perform some method-specific translation of reply keys */
150 if (m_authMethod == ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD) {
151 signonReply[ONLINE_ACCOUNTS_AUTH_KEY_USERNAME] = sessionData.UserName();
152 signonReply[ONLINE_ACCOUNTS_AUTH_KEY_PASSWORD] = sessionData.Secret();
153 } else {
154 signonReply = sessionData.toMap();
155 }
156
157 m_reply = mergeMaps(m_extraReplyData, signonReply);
143 Q_EMIT q->finished();158 Q_EMIT q->finished();
144}159}
145160
@@ -231,4 +246,23 @@
231 return d->m_errorMessage;246 return d->m_errorMessage;
232}247}
233248
249int Authenticator::authMethod(const Accounts::AuthData &authData)
250{
251 QString method = authData.method();
252 QString mechanism = authData.mechanism();
253 if (method == "oauth2") {
254 if (mechanism == "web_server" || mechanism == "user_agent") {
255 return ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH2;
256 } else if (mechanism == "HMAC-SHA1" || mechanism == "PLAINTEXT") {
257 return ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1;
258 }
259 } else if (method == "sasl") {
260 return ONLINE_ACCOUNTS_AUTH_METHOD_SASL;
261 } else if (method == "password") {
262 return ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD;
263 }
264
265 return ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN;
266}
267
234#include "authenticator.moc"268#include "authenticator.moc"
235269
=== modified file 'src/lib/OnlineAccountsDaemon/authenticator.h'
--- src/lib/OnlineAccountsDaemon/authenticator.h 2015-08-28 14:25:23 +0000
+++ src/lib/OnlineAccountsDaemon/authenticator.h 2016-10-06 06:56:41 +0000
@@ -51,6 +51,8 @@
51 QString errorName() const;51 QString errorName() const;
52 QString errorMessage() const;52 QString errorMessage() const;
5353
54 static int authMethod(const Accounts::AuthData &authData);
55
54Q_SIGNALS:56Q_SIGNALS:
55 void finished();57 void finished();
5658
5759
=== modified file 'src/lib/OnlineAccountsDaemon/manager.cpp'
--- src/lib/OnlineAccountsDaemon/manager.cpp 2016-01-13 14:23:12 +0000
+++ src/lib/OnlineAccountsDaemon/manager.cpp 2016-10-06 06:56:41 +0000
@@ -33,6 +33,7 @@
33#include <QSet>33#include <QSet>
34#include "access_request.h"34#include "access_request.h"
35#include "authentication_request.h"35#include "authentication_request.h"
36#include "authenticator.h"
36#include "client_registry.h"37#include "client_registry.h"
37#include "dbus_constants.h"38#include "dbus_constants.h"
38#include "manager_adaptor.h"39#include "manager_adaptor.h"
@@ -76,7 +77,6 @@
76 const QString &serviceName,77 const QString &serviceName,
77 const QStringList &clients);78 const QStringList &clients);
7879
79 int authMethod(const Accounts::AuthData &authData);
80 AccountInfo readAccountInfo(const Accounts::AccountService *as);80 AccountInfo readAccountInfo(const Accounts::AccountService *as);
81 QList<AccountInfo> getAccounts(const QVariantMap &filters,81 QList<AccountInfo> getAccounts(const QVariantMap &filters,
82 const CallContext &context);82 const CallContext &context);
@@ -317,25 +317,6 @@
317 return activeAccount;317 return activeAccount;
318}318}
319319
320int ManagerPrivate::authMethod(const Accounts::AuthData &authData)
321{
322 QString method = authData.method();
323 QString mechanism = authData.mechanism();
324 if (method == "oauth2") {
325 if (mechanism == "web_server" || mechanism == "user_agent") {
326 return ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH2;
327 } else if (mechanism == "HMAC-SHA1" || mechanism == "PLAINTEXT") {
328 return ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1;
329 }
330 } else if (method == "sasl") {
331 return ONLINE_ACCOUNTS_AUTH_METHOD_SASL;
332 } else if (method == "password") {
333 return ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD;
334 }
335
336 return ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN;
337}
338
339AccountInfo ManagerPrivate::readAccountInfo(const Accounts::AccountService *as)320AccountInfo ManagerPrivate::readAccountInfo(const Accounts::AccountService *as)
340{321{
341 QVariantMap info;322 QVariantMap info;
@@ -343,7 +324,7 @@
343 info[ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAME] = as->account()->displayName();324 info[ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAME] = as->account()->displayName();
344 info[ONLINE_ACCOUNTS_INFO_KEY_SERVICE_ID] = as->service().name();325 info[ONLINE_ACCOUNTS_INFO_KEY_SERVICE_ID] = as->service().name();
345326
346 info[ONLINE_ACCOUNTS_INFO_KEY_AUTH_METHOD] = authMethod(as->authData());327 info[ONLINE_ACCOUNTS_INFO_KEY_AUTH_METHOD] = Authenticator::authMethod(as->authData());
347 QString settingsPrefix(QStringLiteral(ONLINE_ACCOUNTS_INFO_KEY_SETTINGS));328 QString settingsPrefix(QStringLiteral(ONLINE_ACCOUNTS_INFO_KEY_SETTINGS));
348 /* First, read the global settings */329 /* First, read the global settings */
349 Accounts::Account *a = as->account();330 Accounts::Account *a = as->account();
350331
=== modified file 'tests/daemon/functional_tests/data/com.ubuntu.tests_coolshare.service'
--- tests/daemon/functional_tests/data/com.ubuntu.tests_coolshare.service 2015-07-08 15:09:56 +0000
+++ tests/daemon/functional_tests/data/com.ubuntu.tests_coolshare.service 2016-10-06 06:56:41 +0000
@@ -4,4 +4,11 @@
4 <name>Cool Share</name>4 <name>Cool Share</name>
5 <icon>general_otherservice</icon>5 <icon>general_otherservice</icon>
6 <provider>cool</provider>6 <provider>cool</provider>
7
8 <template>
9 <group name="auth">
10 <setting name="method">password</setting>
11 <setting name="mechanism">password</setting>
12 </group>
13 </template>
7</service>14</service>
815
=== modified file 'tests/daemon/functional_tests/fake_signond.h'
--- tests/daemon/functional_tests/fake_signond.h 2015-07-06 14:51:30 +0000
+++ tests/daemon/functional_tests/fake_signond.h 2016-10-06 06:56:41 +0000
@@ -37,6 +37,10 @@
37 mockedAuthService().call("AddIdentity", id, info);37 mockedAuthService().call("AddIdentity", id, info);
38 }38 }
3939
40 void setNextReply(uint identity, const QVariantMap &reply) {
41 mockedAuthService().call("SetNextReply", identity, reply);
42 }
43
40private:44private:
41 OrgFreedesktopDBusMockInterface &mockedAuthService() {45 OrgFreedesktopDBusMockInterface &mockedAuthService() {
42 return m_mock->mockInterface("com.google.code.AccountsSSO.SingleSignOn",46 return m_mock->mockInterface("com.google.code.AccountsSSO.SingleSignOn",
4347
=== modified file 'tests/daemon/functional_tests/functional_tests.cpp'
--- tests/daemon/functional_tests/functional_tests.cpp 2016-07-22 05:08:11 +0000
+++ tests/daemon/functional_tests/functional_tests.cpp 2016-10-06 06:56:41 +0000
@@ -186,6 +186,7 @@
186 EnvSetup m_env;186 EnvSetup m_env;
187 DBusService *m_dbus;187 DBusService *m_dbus;
188 int m_firstAccountId;188 int m_firstAccountId;
189 int m_account2CredentialsId;
189 int m_account3CredentialsId;190 int m_account3CredentialsId;
190};191};
191192
@@ -206,6 +207,7 @@
206FunctionalTests::FunctionalTests():207FunctionalTests::FunctionalTests():
207 QObject(),208 QObject(),
208 m_dbus(0),209 m_dbus(0),
210 m_account2CredentialsId(41),
209 m_account3CredentialsId(35)211 m_account3CredentialsId(35)
210{212{
211 clearDb();213 clearDb();
@@ -230,6 +232,7 @@
230 QVERIFY(account2 != 0);232 QVERIFY(account2 != 0);
231 account2->setEnabled(true);233 account2->setEnabled(true);
232 account2->setDisplayName("CoolAccount 2");234 account2->setDisplayName("CoolAccount 2");
235 account2->setCredentialsId(m_account2CredentialsId);
233 account2->selectService(coolMail);236 account2->selectService(coolMail);
234 account2->setEnabled(false);237 account2->setEnabled(false);
235 account2->selectService(coolShare);238 account2->selectService(coolShare);
@@ -262,6 +265,9 @@
262{265{
263 m_dbus = new DBusService();266 m_dbus = new DBusService();
264 m_dbus->startServices();267 m_dbus->startServices();
268
269 /* Uncomment next line to debug DBus calls */
270 // QProcess::startDetached("/usr/bin/dbus-monitor");
265}271}
266272
267void FunctionalTests::cleanup()273void FunctionalTests::cleanup()
@@ -321,16 +327,19 @@
321 QTest::addColumn<bool>("interactive");327 QTest::addColumn<bool>("interactive");
322 QTest::addColumn<bool>("invalidate");328 QTest::addColumn<bool>("invalidate");
323 QTest::addColumn<QVariantMap>("authParams");329 QTest::addColumn<QVariantMap>("authParams");
330 QTest::addColumn<QVariantMap>("signonReply");
324 QTest::addColumn<QVariantMap>("expectedCredentials");331 QTest::addColumn<QVariantMap>("expectedCredentials");
325 QTest::addColumn<QString>("errorName");332 QTest::addColumn<QString>("errorName");
326333
327 QVariantMap authParams;334 QVariantMap authParams;
335 QVariantMap signonReply;
328 QVariantMap credentials;336 QVariantMap credentials;
329 QTest::newRow("invalid account ID") <<337 QTest::newRow("invalid account ID") <<
330 12412341 <<338 12412341 <<
331 "coolmail" <<339 "coolmail" <<
332 false << false <<340 false << false <<
333 authParams <<341 authParams <<
342 signonReply <<
334 credentials <<343 credentials <<
335 ONLINE_ACCOUNTS_ERROR_PERMISSION_DENIED;344 ONLINE_ACCOUNTS_ERROR_PERMISSION_DENIED;
336345
@@ -341,6 +350,7 @@
341 "coolmail" <<350 "coolmail" <<
342 false << false <<351 false << false <<
343 authParams <<352 authParams <<
353 signonReply <<
344 credentials <<354 credentials <<
345 "com.ubuntu.OnlineAccounts.Error.Network";355 "com.ubuntu.OnlineAccounts.Error.Network";
346 authParams.clear();356 authParams.clear();
@@ -354,6 +364,7 @@
354 "coolmail" <<364 "coolmail" <<
355 false << false <<365 false << false <<
356 authParams <<366 authParams <<
367 signonReply <<
357 credentials <<368 credentials <<
358 QString();369 QString();
359370
@@ -363,6 +374,7 @@
363 "coolmail" <<374 "coolmail" <<
364 true << false <<375 true << false <<
365 authParams <<376 authParams <<
377 signonReply <<
366 credentials <<378 credentials <<
367 QString();379 QString();
368380
@@ -372,6 +384,7 @@
372 "coolmail" <<384 "coolmail" <<
373 true << true <<385 true << true <<
374 authParams <<386 authParams <<
387 signonReply <<
375 credentials <<388 credentials <<
376 QString();389 QString();
377390
@@ -385,6 +398,7 @@
385 "oauth1auth" <<398 "oauth1auth" <<
386 true << false <<399 true << false <<
387 authParams <<400 authParams <<
401 signonReply <<
388 credentials <<402 credentials <<
389 QString();403 QString();
390404
@@ -399,6 +413,25 @@
399 "oauth1auth" <<413 "oauth1auth" <<
400 true << false <<414 true << false <<
401 authParams <<415 authParams <<
416 signonReply <<
417 credentials <<
418 QString();
419
420 authParams.clear();
421 credentials = QVariantMap {
422 { ONLINE_ACCOUNTS_AUTH_KEY_USERNAME, "my name" },
423 { ONLINE_ACCOUNTS_AUTH_KEY_PASSWORD, "don't tell" },
424 };
425 signonReply = QVariantMap {
426 { "UserName", "my name" },
427 { "Secret", "don't tell" },
428 };
429 QTest::newRow("password") <<
430 2 <<
431 "com.ubuntu.tests_coolshare" <<
432 true << false <<
433 authParams <<
434 signonReply <<
402 credentials <<435 credentials <<
403 QString();436 QString();
404}437}
@@ -410,10 +443,16 @@
410 QFETCH(bool, interactive);443 QFETCH(bool, interactive);
411 QFETCH(bool, invalidate);444 QFETCH(bool, invalidate);
412 QFETCH(QVariantMap, authParams);445 QFETCH(QVariantMap, authParams);
446 QFETCH(QVariantMap, signonReply);
413 QFETCH(QVariantMap, expectedCredentials);447 QFETCH(QVariantMap, expectedCredentials);
414 QFETCH(QString, errorName);448 QFETCH(QString, errorName);
415449
450 m_dbus->signond().addIdentity(m_account2CredentialsId, QVariantMap());
416 m_dbus->signond().addIdentity(m_account3CredentialsId, QVariantMap());451 m_dbus->signond().addIdentity(m_account3CredentialsId, QVariantMap());
452 if (!signonReply.isEmpty()) {
453 m_dbus->signond().setNextReply(m_account2CredentialsId, signonReply);
454 m_dbus->signond().setNextReply(m_account3CredentialsId, signonReply);
455 }
417456
418 DaemonInterface *daemon = new DaemonInterface(m_dbus->sessionConnection());457 DaemonInterface *daemon = new DaemonInterface(m_dbus->sessionConnection());
419458
@@ -425,8 +464,10 @@
425 if (errorName.isEmpty()) {464 if (errorName.isEmpty()) {
426 QVERIFY2(!reply.isError(), reply.error().message().toUtf8().constData());465 QVERIFY2(!reply.isError(), reply.error().message().toUtf8().constData());
427 QVariantMap credentials = reply.argumentAt<0>();466 QVariantMap credentials = reply.argumentAt<0>();
428 // Add the requestor PID467 if (credentials.contains("requestorPid")) {
429 expectedCredentials["requestorPid"] = getpid();468 // Add the requestor PID
469 expectedCredentials["requestorPid"] = getpid();
470 }
430 QCOMPARE(credentials, expectedCredentials);471 QCOMPARE(credentials, expectedCredentials);
431 } else {472 } else {
432 QVERIFY(reply.isError());473 QVERIFY(reply.isError());
@@ -561,11 +602,14 @@
561602
562 QCOMPARE(serviceId, coolShare.name());603 QCOMPARE(serviceId, coolShare.name());
563 QCOMPARE(accountInfo.id(), account->id());604 QCOMPARE(accountInfo.id(), account->id());
564 QVariantMap expectedAccountInfo;605 QVariantMap expectedAccountInfo {
565 expectedAccountInfo["authMethod"] = ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN;606 { "authMethod", ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD },
566 expectedAccountInfo["changeType"] = ONLINE_ACCOUNTS_INFO_CHANGE_ENABLED;607 { "changeType", ONLINE_ACCOUNTS_INFO_CHANGE_ENABLED },
567 expectedAccountInfo["displayName"] = "New account";608 { "displayName", "New account" },
568 expectedAccountInfo["serviceId"] = "com.ubuntu.tests_coolshare";609 { "serviceId", "com.ubuntu.tests_coolshare" },
610 { "settings/auth/mechanism", "password" },
611 { "settings/auth/method", "password" },
612 };
569 QCOMPARE(accountInfo.data(), expectedAccountInfo);613 QCOMPARE(accountInfo.data(), expectedAccountInfo);
570614
571 /* Change a setting */615 /* Change a setting */
@@ -579,11 +623,15 @@
579623
580 QCOMPARE(serviceId, coolShare.name());624 QCOMPARE(serviceId, coolShare.name());
581 QCOMPARE(accountInfo.id(), account->id());625 QCOMPARE(accountInfo.id(), account->id());
582 expectedAccountInfo["authMethod"] = ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN;626 expectedAccountInfo = QVariantMap {
583 expectedAccountInfo["changeType"] = ONLINE_ACCOUNTS_INFO_CHANGE_UPDATED;627 { "authMethod", ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD },
584 expectedAccountInfo["settings/color"] = "blue";628 { "changeType", ONLINE_ACCOUNTS_INFO_CHANGE_UPDATED },
585 expectedAccountInfo["displayName"] = "New account";629 { "settings/color", "blue" },
586 expectedAccountInfo["serviceId"] = "com.ubuntu.tests_coolshare";630 { "displayName", "New account" },
631 { "serviceId", "com.ubuntu.tests_coolshare" },
632 { "settings/auth/mechanism", "password" },
633 { "settings/auth/method", "password" },
634 };
587 QCOMPARE(accountInfo.data(), expectedAccountInfo);635 QCOMPARE(accountInfo.data(), expectedAccountInfo);
588636
589 /* Delete the account */637 /* Delete the account */
@@ -597,10 +645,15 @@
597645
598 QCOMPARE(serviceId, coolShare.name());646 QCOMPARE(serviceId, coolShare.name());
599 QCOMPARE(accountInfo.id(), account->id());647 QCOMPARE(accountInfo.id(), account->id());
600 expectedAccountInfo["authMethod"] = ONLINE_ACCOUNTS_AUTH_METHOD_UNKNOWN;648 expectedAccountInfo = QVariantMap {
601 expectedAccountInfo["changeType"] = ONLINE_ACCOUNTS_INFO_CHANGE_DISABLED;649 { "authMethod", ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORD },
602 expectedAccountInfo["displayName"] = "New account";650 { "changeType", ONLINE_ACCOUNTS_INFO_CHANGE_DISABLED },
603 expectedAccountInfo["serviceId"] = "com.ubuntu.tests_coolshare";651 { "displayName", "New account" },
652 { "serviceId", "com.ubuntu.tests_coolshare" },
653 { "settings/color", "blue" },
654 { "settings/auth/mechanism", "password" },
655 { "settings/auth/method", "password" },
656 };
604 QCOMPARE(accountInfo.data(), expectedAccountInfo);657 QCOMPARE(accountInfo.data(), expectedAccountInfo);
605658
606 delete manager;659 delete manager;
607660
=== modified file 'tests/daemon/functional_tests/signond.py'
--- tests/daemon/functional_tests/signond.py 2015-07-23 13:57:48 +0000
+++ tests/daemon/functional_tests/signond.py 2016-10-06 06:56:41 +0000
@@ -48,7 +48,11 @@
48 return (path, self.identities[identity])48 return (path, self.identities[identity])
4949
5050
51def auth_session_process(identity, params, method):51def auth_session_process(self, params, method):
52 auth_service = dbusmock.get_object(MAIN_OBJ)
53 if self.identity in auth_service.auth_replies:
54 return auth_service.auth_replies[self.identity]
55
52 if 'errorName' in params:56 if 'errorName' in params:
53 raise dbus.exceptions.DBusException('Authentication error',57 raise dbus.exceptions.DBusException('Authentication error',
54 name=params['errorName'])58 name=params['errorName'])
@@ -63,7 +67,7 @@
63 path = '/AuthSession%s' % self.sessions_counter67 path = '/AuthSession%s' % self.sessions_counter
64 self.sessions_counter += 168 self.sessions_counter += 1
65 self.AddObject(path, AUTH_SESSION_IFACE, {}, [69 self.AddObject(path, AUTH_SESSION_IFACE, {}, [
66 ('process', 'a{sv}s', 'a{sv}', 'ret = self.auth_session_process(self.identity, args[0], args[1])'),70 ('process', 'a{sv}s', 'a{sv}', 'ret = self.auth_session_process(self, args[0], args[1])'),
67 ])71 ])
6872
69 auth_session = dbusmock.get_object(path)73 auth_session = dbusmock.get_object(path)
@@ -91,3 +95,7 @@
91def AddIdentity(self, identity, data):95def AddIdentity(self, identity, data):
92 self.identities[identity] = data96 self.identities[identity] = data
9397
98@dbus.service.method(MOCK_IFACE, in_signature='ua{sv}', out_signature='')
99def SetNextReply(self, identity, reply):
100 self.auth_replies[identity] = reply
101

Subscribers

People subscribed via source and target branches