aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-01-24 20:13:16 +0100
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commit4e0fe24681daef069abde3448c26f5cb850d8bb7 (patch)
tree0c4f789e68255d5ad811363bf3560facc59e06ca
parentfaaea2eb2a090787f365eb12a42f8452bb0f07e2 (diff)
downloadlibquotient-4e0fe24681daef069abde3448c26f5cb850d8bb7.tar.gz
libquotient-4e0fe24681daef069abde3448c26f5cb850d8bb7.zip
Update test
-rw-r--r--autotests/testgroupsession.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/autotests/testgroupsession.cpp b/autotests/testgroupsession.cpp
index 02892366..1cfe38a9 100644
--- a/autotests/testgroupsession.cpp
+++ b/autotests/testgroupsession.cpp
@@ -12,27 +12,26 @@ using namespace Quotient;
void TestOlmSession::groupSessionPicklingValid()
{
- auto ogs = std::get<QOlmOutboundGroupSession>(QOlmOutboundGroupSession::create());
- const auto ogsId = std::get<QByteArray>(ogs.sessionId());
+ auto ogs = QOlmOutboundGroupSession::create();
+ const auto ogsId = std::get<QByteArray>(ogs->sessionId());
QVERIFY(QByteArray::fromBase64Encoding(ogsId).decodingStatus == QByteArray::Base64DecodingStatus::Ok);
- QCOMPARE(0, ogs.sessionMessageIndex());
+ QCOMPARE(0, ogs->sessionMessageIndex());
- auto ogsPickled = std::get<QByteArray>(ogs.pickle(Unencrypted {}));
- ogs = std::get<QOlmOutboundGroupSession>(QOlmOutboundGroupSession::unpickle(ogsPickled, Unencrypted {}));
- QCOMPARE(ogsId, std::get<QByteArray>(ogs.sessionId()));
+ auto ogsPickled = std::get<QByteArray>(ogs->pickle(Unencrypted {}));
+ auto ogs2 = std::get<std::unique_ptr<QOlmOutboundGroupSession>>(QOlmOutboundGroupSession::unpickle(ogsPickled, Unencrypted {}));
+ QCOMPARE(ogsId, std::get<QByteArray>(ogs2->sessionId()));
- qDebug() << std::get<QByteArray>(ogs.sessionKey());
- auto igs = std::get<QOlmInboundGroupSession>(QOlmInboundGroupSession::create(std::get<QByteArray>(ogs.sessionKey())));
- const auto igsId = std::get<QByteArray>(igs.sessionId());
+ auto igs = QOlmInboundGroupSession::create(std::get<QByteArray>(ogs->sessionKey()));
+ const auto igsId = igs->sessionId();
// ID is valid base64?
QVERIFY(QByteArray::fromBase64Encoding(igsId).decodingStatus == QByteArray::Base64DecodingStatus::Ok);
//// no messages have been sent yet
- QCOMPARE(0, igs.firstKnownIndex());
+ QCOMPARE(0, igs->firstKnownIndex());
- auto igsPickled = std::get<QByteArray>(igs.pickle(Unencrypted {}));
- igs = std::get<QOlmInboundGroupSession>(QOlmInboundGroupSession::unpickle(igsPickled, Unencrypted {}));
- QCOMPARE(igsId, std::get<QByteArray>(igs.sessionId()));
+ auto igsPickled = igs->pickle(Unencrypted {});
+ igs = std::get<std::unique_ptr<QOlmInboundGroupSession>>(QOlmInboundGroupSession::unpickle(igsPickled, Unencrypted {}));
+ QCOMPARE(igsId, igs->sessionId());
}
QTEST_MAIN(TestOlmSession)