aboutsummaryrefslogtreecommitdiff
path: root/autotests
diff options
context:
space:
mode:
authorTobias Fella <9750016+TobiasFella@users.noreply.github.com>2022-01-30 23:15:42 +0100
committerGitHub <noreply@github.com>2022-01-30 23:15:42 +0100
commit27baabc9b8c9476fc550aef4462c193d5a9997a6 (patch)
tree960cda535d31ad1c60572641cede05f29d922900 /autotests
parent023ef3005d3fae80637c6ce140e84db26250d564 (diff)
downloadlibquotient-27baabc9b8c9476fc550aef4462c193d5a9997a6.tar.gz
libquotient-27baabc9b8c9476fc550aef4462c193d5a9997a6.zip
Apply suggestions from code review
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
Diffstat (limited to 'autotests')
-rw-r--r--autotests/testolmutility.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/autotests/testolmutility.cpp b/autotests/testolmutility.cpp
index bbf3a055..d0476af0 100644
--- a/autotests/testolmutility.cpp
+++ b/autotests/testolmutility.cpp
@@ -47,14 +47,14 @@ void TestOlmUtility::canonicalJSON()
void TestOlmUtility::verifySignedOneTimeKey()
{
- auto aliceOlm = std::make_shared<QOlmAccount>("alice:matrix.org", "aliceDevice");
- aliceOlm->createNewAccount();
- aliceOlm->generateOneTimeKeys(1);
- auto keys = aliceOlm->oneTimeKeys();
+ QOlmAccount aliceOlm { "@alice:matrix.org", "aliceDevice" };
+ aliceOlm.createNewAccount();
+ aliceOlm.generateOneTimeKeys(1);
+ auto keys = aliceOlm.oneTimeKeys();
auto firstKey = keys.curve25519().keyValueBegin()->second;
auto msgObj = QJsonObject({{"key", firstKey}});
- auto sig = aliceOlm->sign(msgObj);
+ auto sig = aliceOlm.sign(msgObj);
auto msg = QJsonDocument(msgObj).toJson(QJsonDocument::Compact);
@@ -66,8 +66,8 @@ void TestOlmUtility::verifySignedOneTimeKey()
std::copy(sig.begin(), sig.end(), signatureBuf1.begin());
auto res = olm_ed25519_verify(utility,
- aliceOlm->identityKeys().ed25519.data(),
- aliceOlm->identityKeys().ed25519.size(),
+ aliceOlm.identityKeys().ed25519.data(),
+ aliceOlm.identityKeys().ed25519.size(),
msg.data(),
msg.size(),
(void *)sig.data(),
@@ -79,7 +79,7 @@ void TestOlmUtility::verifySignedOneTimeKey()
delete[](reinterpret_cast<uint8_t *>(utility));
QOlmUtility utility2;
- auto res2 = std::get<bool>(utility2.ed25519Verify(aliceOlm->identityKeys().ed25519, msg, signatureBuf1));
+ auto res2 = std::get<bool>(utility2.ed25519Verify(aliceOlm.identityKeys().ed25519, msg, signatureBuf1));
//QCOMPARE(std::string(olm_utility_last_error(utility)), "SUCCESS");
QCOMPARE(res2, true);
@@ -90,11 +90,11 @@ void TestOlmUtility::validUploadKeysRequest()
const auto userId = QStringLiteral("@alice:matrix.org");
const auto deviceId = QStringLiteral("FKALSOCCC");
- auto alice = std::make_shared<QOlmAccount>(userId, deviceId);
- alice->createNewAccount();
- alice->generateOneTimeKeys(1);
+ QOlmAccount alice { userId, deviceId };
+ alice.createNewAccount();
+ alice.generateOneTimeKeys(1);
- auto idSig = alice->signIdentityKeys();
+ auto idSig = alice.signIdentityKeys();
QJsonObject body
{
@@ -103,8 +103,8 @@ void TestOlmUtility::validUploadKeysRequest()
{"device_id", deviceId},
{"keys",
QJsonObject{
- {QStringLiteral("curve25519:") + deviceId, QString::fromUtf8(alice->identityKeys().curve25519)},
- {QStringLiteral("ed25519:") + deviceId, QString::fromUtf8(alice->identityKeys().ed25519)}
+ {QStringLiteral("curve25519:") + deviceId, QString::fromUtf8(alice.identityKeys().curve25519)},
+ {QStringLiteral("ed25519:") + deviceId, QString::fromUtf8(alice.identityKeys().ed25519)}
}
},
{"signatures",
@@ -118,7 +118,7 @@ void TestOlmUtility::validUploadKeysRequest()
}
};
- DeviceKeys deviceKeys = alice->deviceKeys();
+ DeviceKeys deviceKeys = alice.deviceKeys();
QCOMPARE(QJsonDocument(toJson(deviceKeys)).toJson(QJsonDocument::Compact),
QJsonDocument(body).toJson(QJsonDocument::Compact));