summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Scarpino <scarpino@kde.org>2017-12-21 21:28:29 +0100
committerAndrea Scarpino <scarpino@kde.org>2017-12-22 19:04:14 +0000
commitf6aedc74c4a95440e649b625b6272f29e7f5fa71 (patch)
treeedd4e94f1b08ceac91d9cc6e7e3d19b41a95b6f9
parentff679d2ff87894908470e9fb2edc5d149f0858c0 (diff)
Fix QOAuth1::tokenSecret() return value
Commit c071b588ce2b4d474845d553aa83120747dc46da broke QOAuth1::tokenSecret(), in fact, it were returning the clientIdentifierSharedKey instead. [ChangeLog][QOAuth1] Fix tokenSecret() return value. Task-number: QTBUG-65422 Change-Id: I72d6783220e7a030eac65e5c22e4421a1d6b106e Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
-rw-r--r--src/oauth/qoauth1.cpp2
-rw-r--r--tests/auto/oauth1/tst_oauth1.cpp19
2 files changed, 19 insertions, 2 deletions
diff --git a/src/oauth/qoauth1.cpp b/src/oauth/qoauth1.cpp
index 581ce4a..fcff92e 100644
--- a/src/oauth/qoauth1.cpp
+++ b/src/oauth/qoauth1.cpp
@@ -391,7 +391,7 @@ void QOAuth1::setClientCredentials(const QString &clientIdentifier,
QString QOAuth1::tokenSecret() const
{
Q_D(const QOAuth1);
- return d->clientIdentifierSharedKey;
+ return d->tokenSecret;
}
/*!
Sets \a tokenSecret as the current token secret used to sign
diff --git a/tests/auto/oauth1/tst_oauth1.cpp b/tests/auto/oauth1/tst_oauth1.cpp
index 50822bd..7bfc628 100644
--- a/tests/auto/oauth1/tst_oauth1.cpp
+++ b/tests/auto/oauth1/tst_oauth1.cpp
@@ -145,6 +145,7 @@ public Q_SLOTS:
private Q_SLOTS:
void clientIdentifierSignal();
void clientSharedSecretSignal();
+ void tokenSignal();
void tokenSecretSignal();
void temporaryCredentialsUrlSignal();
void temporaryTokenCredentialsUrlSignal();
@@ -252,7 +253,7 @@ void tst_OAuth1::clientSharedSecretSignal()
PropertyTester::run(&QOAuth1::clientSharedSecretChanged, setters);
}
-void tst_OAuth1::tokenSecretSignal()
+void tst_OAuth1::tokenSignal()
{
using PropertyTester = PropertyTester<QString>;
PropertyTester::SetterFunctions setters {
@@ -268,6 +269,22 @@ void tst_OAuth1::tokenSecretSignal()
PropertyTester::run(&QOAuth1::tokenChanged, setters);
}
+void tst_OAuth1::tokenSecretSignal()
+{
+ using PropertyTester = PropertyTester<QString>;
+ PropertyTester::SetterFunctions setters {
+ [](QString *expectedValue, QOAuth1 *object) {
+ *expectedValue = "setTokenSecret";
+ object->setTokenSecret(*expectedValue);
+ },
+ [](QString *expectedValue, QOAuth1 *object) {
+ *expectedValue = "setTokenCredentials";
+ object->setTokenCredentials(qMakePair(QString(), *expectedValue));
+ }
+ };
+ PropertyTester::run(&QOAuth1::tokenSecretChanged, setters);
+}
+
void tst_OAuth1::temporaryCredentialsUrlSignal()
{
using PropertyTester = PropertyTester<QUrl>;