fix(test): Don't rely on row IDs after moving tables

Row ID's are not guaranteed to match those from the original peer table.

New checking method is equally strict since we already verify the number
of entries, and the SQL schema guarantees that entries are unique.
reviewable/pr6611/r6
Anthony Bilinski 2022-03-31 20:16:45 -07:00
parent 265398a44e
commit 00119ff0d4
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
1 changed files with 2 additions and 2 deletions

View File

@ -54,8 +54,8 @@ RowId getValidPeerRow(RawDatabase& db, const ChatId& chatId)
{
bool validPeerExists{false};
RowId validPeerRow;
db.execNow(RawDatabase::Query(QStringLiteral("SELECT id FROM peers WHERE public_key='%1';")
.arg(chatId.toString()),
db.execNow(RawDatabase::Query(QStringLiteral("SELECT id FROM peers WHERE CAST(public_key AS BLOB)=?;"),
{chatId.toString().toUtf8()},
[&](const QVector<QVariant>& row) {
validPeerRow = RowId{row[0].toLongLong()};
validPeerExists = true;