aboutsummaryrefslogtreecommitdiff
path: root/autotests/testolmaccount.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-09-06 21:35:27 +0200
committerTobias Fella <fella@posteo.de>2022-09-06 21:35:27 +0200
commitecf6b855b0fc8cbe16d34b67ae1dca7bd9b69948 (patch)
tree5e091f5c114cecd1082d45fb17361438a39f3624 /autotests/testolmaccount.cpp
parent66127730592eadf9ee717a53a521ac2ec14f1051 (diff)
downloadlibquotient-ecf6b855b0fc8cbe16d34b67ae1dca7bd9b69948.tar.gz
libquotient-ecf6b855b0fc8cbe16d34b67ae1dca7bd9b69948.zip
Add autotest for key verification and fix several edge-cases
Diffstat (limited to 'autotests/testolmaccount.cpp')
-rw-r--r--autotests/testolmaccount.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/autotests/testolmaccount.cpp b/autotests/testolmaccount.cpp
index 4b32393d..280705d0 100644
--- a/autotests/testolmaccount.cpp
+++ b/autotests/testolmaccount.cpp
@@ -14,6 +14,8 @@
#include <networkaccessmanager.h>
#include <room.h>
+#include "testutils.h"
+
using namespace Quotient;
void TestOlmAccount::pickleUnpickledTest()
@@ -168,26 +170,6 @@ void TestOlmAccount::encryptedFile()
QCOMPARE(file.key.kty, "oct");
}
-#define CREATE_CONNECTION(VAR, USERNAME, SECRET, DEVICE_NAME) \
- NetworkAccessManager::instance()->ignoreSslErrors(true); \
- auto VAR = std::make_shared<Connection>(); \
- (VAR)->resolveServer("@" USERNAME ":localhost:1234"); \
- connect((VAR).get(), &Connection::loginFlowsChanged, this, [=] { \
- (VAR)->loginWithPassword((USERNAME), SECRET, DEVICE_NAME, ""); \
- }); \
- connect((VAR).get(), &Connection::networkError, [](const QString& error) { \
- QWARN(qUtf8Printable(error)); \
- QFAIL("Network error: make sure synapse is running"); \
- }); \
- connect((VAR).get(), &Connection::loginError, [](const QString& error) { \
- QWARN(qUtf8Printable(error)); \
- QFAIL("Login failed"); \
- }); \
- QSignalSpy spy##VAR((VAR).get(), &Connection::loginFlowsChanged); \
- QSignalSpy spy2##VAR((VAR).get(), &Connection::connected); \
- QVERIFY(spy##VAR.wait(10000)); \
- QVERIFY(spy2##VAR.wait(10000));
-
void TestOlmAccount::uploadIdentityKey()
{
CREATE_CONNECTION(conn, "alice1", "secret", "AlicePhone")