From 8a9de185a994c56ec7e73706a68b3d18cc7ea7d1 Mon Sep 17 00:00:00 2001 From: Thomas Witt Date: Sat, 30 Mar 2024 16:17:49 +0100 Subject: [PATCH 1/3] pushnotification testutils: Bind only to LocalHost LocalHost is enough to complete the tests, and it enables the test to be run under networksandboxing. Signed-off-by: Thomas Witt --- test/pushnotificationstestutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pushnotificationstestutils.cpp b/test/pushnotificationstestutils.cpp index 389d41dd7f542..7df542ec45b1e 100644 --- a/test/pushnotificationstestutils.cpp +++ b/test/pushnotificationstestutils.cpp @@ -13,7 +13,7 @@ FakeWebSocketServer::FakeWebSocketServer(quint16 port, QObject *parent) : QObject(parent) , _webSocketServer(new QWebSocketServer(QStringLiteral("Fake Server"), QWebSocketServer::NonSecureMode, this)) { - if (!_webSocketServer->listen(QHostAddress::Any, port)) { + if (!_webSocketServer->listen(QHostAddress::LocalHost, port)) { Q_UNREACHABLE(); } connect(_webSocketServer, &QWebSocketServer::newConnection, this, &FakeWebSocketServer::onNewConnection); From d0097ce25cf913c01d53bb324e0d61a6a66f244d Mon Sep 17 00:00:00 2001 From: Thomas Witt Date: Sat, 30 Mar 2024 16:18:10 +0100 Subject: [PATCH 2/3] SyncConfilctsModel test: use FakeAccountState Using the real account state needs an internet connection. Additionally, `example.de` is a valid existing domain, which should probably not be used in testing. Switching to `example.com` as this is recommended here. Signed-off-by: Thomas Witt --- test/testsyncconflictsmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testsyncconflictsmodel.cpp b/test/testsyncconflictsmodel.cpp index de1596cc38e5f..7fc49fcfd5aa6 100644 --- a/test/testsyncconflictsmodel.cpp +++ b/test/testsyncconflictsmodel.cpp @@ -61,13 +61,13 @@ private slots: FolderMan fm; auto account = Account::create(); - auto url = QUrl{"http://example.de"}; + auto url = QUrl{"http://example.com"}; auto cred = new HttpCredentialsTest("testuser", "secret"); account->setCredentials(cred); account->setUrl(url); url.setUserName(cred->user()); - auto newAccountState{AccountStatePtr{ new AccountState{account}}}; + auto newAccountState{AccountStatePtr{ new FakeAccountState{account}}}; auto folderman = FolderMan::instance(); QCOMPARE(folderman, &fm); From a5a31321f843ee875c7dd55ac60896caf36f2857 Mon Sep 17 00:00:00 2001 From: Thomas Witt Date: Sat, 30 Mar 2024 16:18:26 +0100 Subject: [PATCH 3/3] UserStatusDialog.cpp: Fix timezone This test fails on the day before a timezone switch: Actual (model.clearAtDisplayString()): "23 hours" Expected (tr("1 day")) : "1 day" Setting the timezone to UTC remedies this problem. Signed-off-by: Thomas Witt --- test/testsetuserstatusdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testsetuserstatusdialog.cpp b/test/testsetuserstatusdialog.cpp index 0352216234f99..49487fccc15c4 100644 --- a/test/testsetuserstatusdialog.cpp +++ b/test/testsetuserstatusdialog.cpp @@ -187,7 +187,7 @@ class TestSetUserStatusDialog : public QObject private slots: void testCtor_fetchStatusAndPredefinedStatuses() { - const QDateTime currentDateTime(QDateTime::currentDateTime()); + const QDateTime currentDateTime(QDateTime::currentDateTimeUtc()); const QString userStatusId("fake-id"); const QString userStatusMessage("Some status");