aboutsummaryrefslogtreecommitdiff
path: root/autotests/testolmaccount.cpp
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-06-10 23:57:15 +0200
committerTobias Fella <fella@posteo.de>2021-12-01 21:56:11 +0100
commit0ec4df82265c2f796035c0c103b9f6693f62e24a (patch)
tree786eba8a391bac4521f7b5d821fe90ab67ac016a /autotests/testolmaccount.cpp
parentd30a5153cca335ff6f23cc5a3019001913df0edd (diff)
downloadlibquotient-0ec4df82265c2f796035c0c103b9f6693f62e24a.tar.gz
libquotient-0ec4df82265c2f796035c0c103b9f6693f62e24a.zip
Fix setting encrypted flag in rooms
Diffstat (limited to 'autotests/testolmaccount.cpp')
-rw-r--r--autotests/testolmaccount.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/autotests/testolmaccount.cpp b/autotests/testolmaccount.cpp
index 4ab21a8a..c7edd7ad 100644
--- a/autotests/testolmaccount.cpp
+++ b/autotests/testolmaccount.cpp
@@ -519,10 +519,6 @@ void TestOlmAccount::keyChange()
auto aliceOlm = alice->olmAccount();
aliceOlm->generateOneTimeKeys(1);
auto aliceRes = aliceOlm->createUploadKeyRequest(aliceOlm->oneTimeKeys());
- connect(aliceRes, &BaseJob::result, this, [aliceRes] {
- QCOMPARE(aliceRes->oneTimeKeyCounts().size(), 1);
- QCOMPARE(aliceRes->oneTimeKeyCounts()["signed_curve25519"], 1);
- });
QSignalSpy spy(aliceRes, &BaseJob::result);
alice->run(aliceRes);
@@ -557,12 +553,15 @@ void TestOlmAccount::enableEncryption()
auto job = alice->createRoom(Connection::PublishRoom, QString(), QString(), QString(), {"@bob:localhost"});
connect(alice.get(), &Connection::newRoom, this, [alice, bob, &joinedRoom, this] (Quotient::Room *room) {
room->activateEncryption(); // TODO we should also wait for it
+ QSignalSpy spy(room, &Room::encryption);
+
joinedRoom = room->id();
- sleep(1);
auto job = bob->joinRoom(room->id());
- QSignalSpy spy(job, &BaseJob::result);
+ QSignalSpy spy1(job, &BaseJob::result);
QVERIFY(spy.wait(10000));
+ QVERIFY(spy1.wait(10000));
});
+
QSignalSpy spy(job, &BaseJob::result);
QVERIFY(spy.wait(10000));
@@ -574,8 +573,14 @@ void TestOlmAccount::enableEncryption()
auto event = it->event();
if (eventCast<const EncryptedEvent>(event)) {
hasEncryption = true;
+ } else {
+ qDebug() << event->matrixType() << typeId<EncryptedEvent>() << event->type();
+ if ( event->matrixType() == "m.room.encryption") {
+ qDebug() << event->contentJson();
+ }
}
}
+ QVERIFY(bob->room(joinedRoom)->usesEncryption());
QVERIFY(hasEncryption);
});
QSignalSpy spy2(bob.get(), &Connection::syncDone);