aboutsummaryrefslogtreecommitdiff
path: root/autotests/testgroupsession.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-16 17:38:34 +0200
committerGitHub <noreply@github.com>2022-05-16 17:38:34 +0200
commit77b190d822c1e980b98b84999f0cfb609ed05a49 (patch)
tree049fc3936343a7af957c0bca20dd1531ae2e5f81 /autotests/testgroupsession.cpp
parent0599ef6e603dce219b2ba000d7322e8d937753b9 (diff)
parentdecc676f1e469dc26c80c33da64fad15805de8f2 (diff)
downloadlibquotient-77b190d822c1e980b98b84999f0cfb609ed05a49.tar.gz
libquotient-77b190d822c1e980b98b84999f0cfb609ed05a49.zip
Merge #550: Quotient::Expected and QOlmExpected
Diffstat (limited to 'autotests/testgroupsession.cpp')
-rw-r--r--autotests/testgroupsession.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/autotests/testgroupsession.cpp b/autotests/testgroupsession.cpp
index 2566669e..3c329a8a 100644
--- a/autotests/testgroupsession.cpp
+++ b/autotests/testgroupsession.cpp
@@ -16,11 +16,11 @@ void TestGroupSession::groupSessionPicklingValid()
QVERIFY(QByteArray::fromBase64(ogsId).size() > 0);
QCOMPARE(0, ogs->sessionMessageIndex());
- auto ogsPickled = std::get<QByteArray>(ogs->pickle(Unencrypted {}));
- auto ogs2 = std::get<QOlmOutboundGroupSessionPtr>(QOlmOutboundGroupSession::unpickle(ogsPickled, Unencrypted {}));
+ auto ogsPickled = ogs->pickle(Unencrypted {}).value();
+ auto ogs2 = QOlmOutboundGroupSession::unpickle(ogsPickled, Unencrypted {}).value();
QCOMPARE(ogsId, ogs2->sessionId());
- auto igs = QOlmInboundGroupSession::create(std::get<QByteArray>(ogs->sessionKey()));
+ auto igs = QOlmInboundGroupSession::create(ogs->sessionKey().value());
const auto igsId = igs->sessionId();
// ID is valid base64?
QVERIFY(QByteArray::fromBase64(igsId).size() > 0);
@@ -29,22 +29,22 @@ void TestGroupSession::groupSessionPicklingValid()
QCOMPARE(0, igs->firstKnownIndex());
auto igsPickled = igs->pickle(Unencrypted {});
- igs = std::get<QOlmInboundGroupSessionPtr>(QOlmInboundGroupSession::unpickle(igsPickled, Unencrypted {}));
+ igs = QOlmInboundGroupSession::unpickle(igsPickled, Unencrypted {}).value();
QCOMPARE(igsId, igs->sessionId());
}
void TestGroupSession::groupSessionCryptoValid()
{
auto ogs = QOlmOutboundGroupSession::create();
- auto igs = QOlmInboundGroupSession::create(std::get<QByteArray>(ogs->sessionKey()));
+ auto igs = QOlmInboundGroupSession::create(ogs->sessionKey().value());
QCOMPARE(ogs->sessionId(), igs->sessionId());
const auto plainText = QStringLiteral("Hello world!");
- const auto ciphertext = std::get<QByteArray>(ogs->encrypt(plainText));
+ const auto ciphertext = ogs->encrypt(plainText).value();
// ciphertext valid base64?
QVERIFY(QByteArray::fromBase64(ciphertext).size() > 0);
- const auto decryptionResult = std::get<std::pair<QString, uint32_t>>(igs->decrypt(ciphertext));
+ const auto decryptionResult = igs->decrypt(ciphertext).value();
//// correct plaintext?
QCOMPARE(plainText, decryptionResult.first);