aboutsummaryrefslogtreecommitdiff
path: root/autotests/testgroupsession.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-26 15:20:53 +0200
committerGitHub <noreply@github.com>2022-09-26 15:20:53 +0200
commit4c8dcbc308eb0f4900e416e698f5f30e71daaad8 (patch)
treeaa5fdaa81234a21c6919fac4958f84d7c26cd397 /autotests/testgroupsession.cpp
parent5904a61c59f0eef00aef07ef998658fd791ff139 (diff)
parent15b840d82d4794358fbf1271ea76e446b47db7e5 (diff)
downloadlibquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.tar.gz
libquotient-4c8dcbc308eb0f4900e416e698f5f30e71daaad8.zip
Merge #571: Unify reporting and handling of Olm errors
Diffstat (limited to 'autotests/testgroupsession.cpp')
-rw-r--r--autotests/testgroupsession.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/autotests/testgroupsession.cpp b/autotests/testgroupsession.cpp
index 3c329a8a..1054a160 100644
--- a/autotests/testgroupsession.cpp
+++ b/autotests/testgroupsession.cpp
@@ -16,11 +16,13 @@ void TestGroupSession::groupSessionPicklingValid()
QVERIFY(QByteArray::fromBase64(ogsId).size() > 0);
QCOMPARE(0, ogs->sessionMessageIndex());
- auto ogsPickled = ogs->pickle(Unencrypted {}).value();
- auto ogs2 = QOlmOutboundGroupSession::unpickle(ogsPickled, Unencrypted {}).value();
+ auto&& ogsPickled = ogs->pickle(Unencrypted {});
+ auto ogs2 =
+ QOlmOutboundGroupSession::unpickle(std::move(ogsPickled), Unencrypted{})
+ .value();
QCOMPARE(ogsId, ogs2->sessionId());
- auto igs = QOlmInboundGroupSession::create(ogs->sessionKey().value());
+ auto igs = QOlmInboundGroupSession::create(ogs->sessionKey()).value();
const auto igsId = igs->sessionId();
// ID is valid base64?
QVERIFY(QByteArray::fromBase64(igsId).size() > 0);
@@ -29,18 +31,19 @@ void TestGroupSession::groupSessionPicklingValid()
QCOMPARE(0, igs->firstKnownIndex());
auto igsPickled = igs->pickle(Unencrypted {});
- igs = QOlmInboundGroupSession::unpickle(igsPickled, Unencrypted {}).value();
+ igs = QOlmInboundGroupSession::unpickle(std::move(igsPickled), Unencrypted{})
+ .value();
QCOMPARE(igsId, igs->sessionId());
}
void TestGroupSession::groupSessionCryptoValid()
{
auto ogs = QOlmOutboundGroupSession::create();
- auto igs = QOlmInboundGroupSession::create(ogs->sessionKey().value());
+ auto igs = QOlmInboundGroupSession::create(ogs->sessionKey()).value();
QCOMPARE(ogs->sessionId(), igs->sessionId());
- const auto plainText = QStringLiteral("Hello world!");
- const auto ciphertext = ogs->encrypt(plainText).value();
+ const auto plainText = "Hello world!";
+ const auto ciphertext = ogs->encrypt(plainText);
// ciphertext valid base64?
QVERIFY(QByteArray::fromBase64(ciphertext).size() > 0);