diff options
Diffstat (limited to 'tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp')
| -rw-r--r-- | tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp b/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp index 9a66efe..66e3a81 100644 --- a/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp +++ b/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp @@ -9,12 +9,15 @@ typedef QSharedPointer<QNetworkReply> QNetworkReplyPtr; +using namespace Qt::StringLiterals; + class tst_QOAuthHttpServerReplyHandler : public QObject { Q_OBJECT private Q_SLOTS: void callback(); + void callbackCaching(); }; void tst_QOAuthHttpServerReplyHandler::callback() @@ -46,5 +49,31 @@ void tst_QOAuthHttpServerReplyHandler::callback() QCOMPARE(count, query.queryItems().size()); } +void tst_QOAuthHttpServerReplyHandler::callbackCaching() +{ + QOAuthHttpServerReplyHandler replyHandler; + constexpr auto callbackPath = "/foo"_L1; + constexpr auto callbackHost = "127.0.0.1"_L1; + + QVERIFY(replyHandler.isListening()); + replyHandler.setCallbackPath(callbackPath); + QUrl callback = replyHandler.callback(); + QCOMPARE(callback.path(), callbackPath); + QCOMPARE(callback.host(), callbackHost); + + replyHandler.close(); + QVERIFY(!replyHandler.isListening()); + callback = replyHandler.callback(); + // Should remain after close + QCOMPARE(callback.path(), callbackPath); + QCOMPARE(callback.host(), callbackHost); + + replyHandler.listen(); + QVERIFY(replyHandler.isListening()); + callback = replyHandler.callback(); + QCOMPARE(callback.path(), callbackPath); + QCOMPARE(callback.host(), callbackHost); +} + QTEST_MAIN(tst_QOAuthHttpServerReplyHandler) #include "tst_oauthhttpserverreplyhandler.moc" |
