aboutsummaryrefslogtreecommitdiff
path: root/tests/sasl.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-05 15:28:18 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-05 15:28:18 +0200
commit9168d631d5c266ee79c3112840423d4fca0c96dd (patch)
treed5e9d67627ca46cb04eb63e06a50ffa7dc38aa7d /tests/sasl.cpp
parent49d30871e8a605bea9679353afd9a6fb6a877664 (diff)
downloadqxmpp-9168d631d5c266ee79c3112840423d4fca0c96dd.tar.gz
Add support for X-OAUTH2 authentication for Google Talk.
Diffstat (limited to 'tests/sasl.cpp')
-rw-r--r--tests/sasl.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/sasl.cpp b/tests/sasl.cpp
index 7cf2097d..3df81e59 100644
--- a/tests/sasl.cpp
+++ b/tests/sasl.cpp
@@ -153,7 +153,7 @@ void tst_QXmppSasl::testSuccess()
void tst_QXmppSaslClient::testAvailableMechanisms()
{
- QCOMPARE(QXmppSaslClient::availableMechanisms(), QStringList() << "PLAIN" << "DIGEST-MD5" << "ANONYMOUS" << "X-FACEBOOK-PLATFORM" << "X-MESSENGER-OAUTH2");
+ QCOMPARE(QXmppSaslClient::availableMechanisms(), QStringList() << "PLAIN" << "DIGEST-MD5" << "ANONYMOUS" << "X-FACEBOOK-PLATFORM" << "X-MESSENGER-OAUTH2" << "X-OAUTH2");
}
void tst_QXmppSaslClient::testBadMechanism()
@@ -243,6 +243,26 @@ void tst_QXmppSaslClient::testFacebook()
delete client;
}
+void tst_QXmppSaslClient::testGoogle()
+{
+ QXmppSaslClient *client = QXmppSaslClient::create("X-OAUTH2");
+ QVERIFY(client != 0);
+ QCOMPARE(client->mechanism(), QLatin1String("X-OAUTH2"));
+
+ client->setUsername("foo");
+ client->setPassword("bar");
+
+ // initial step returns data
+ QByteArray response;
+ QVERIFY(client->respond(QByteArray(), response));
+ QCOMPARE(response, QByteArray("\0foo\0bar", 8));
+
+ // any further step is an error
+ QVERIFY(!client->respond(QByteArray(), response));
+
+ delete client;
+}
+
void tst_QXmppSaslClient::testPlain()
{
QXmppSaslClient *client = QXmppSaslClient::create("PLAIN");