diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-08-24 15:56:04 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-08-24 19:56:07 +0300 |
commit | 43148d0c3ba7f7857c590e7819ea699b84fd2733 (patch) | |
tree | 329566cd58991f129d094d33bae9c696b7f3bc70 /test | |
parent | fd928269beb5d50699e5dd924890caeed8118d30 (diff) |
Handle timeout during token refresh
Diffstat (limited to 'test')
-rw-r--r-- | test/testoauth.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/testoauth.cpp b/test/testoauth.cpp index a8b0dbaaf..0054d6f13 100644 --- a/test/testoauth.cpp +++ b/test/testoauth.cpp @@ -392,6 +392,36 @@ private slots: } test; test.test(); } + + + void testTimeout() + { + struct Test : OAuthTestCase + { + QScopedValueRollback<int> rollback; + + Test() + : rollback(AbstractNetworkJob::httpTimeout, 1) + { + localHost = QLatin1String("127.0.0.1"); + } + + QNetworkReply *statusPhpReply(QNetworkAccessManager::Operation op, const QNetworkRequest &req) override + { + OC_ASSERT(op == QNetworkAccessManager::GetOperation); + return new FakeHangingReply(op, req, fakeQnam); + } + + void oauthResult(OAuth::Result result, const QString &user, const QString &token, const QString &refreshToken) override + { + QCOMPARE(state, StartState); + QCOMPARE(result, OAuth::Error); + gotAuthOk = true; + replyToBrowserOk = true; + } + } test; + test.test(); + } }; |