FdoSecrets: use EntrySearcher's internal search API

This commit is contained in:
Aetf 2019-11-01 16:42:00 -04:00 committed by Jonathan White
parent b96c1e92a3
commit f9097c84e9
6 changed files with 54 additions and 37 deletions

View file

@ -19,8 +19,11 @@
#include "TestGlobal.h"
#include "core/EntrySearcher.h"
#include "fdosecrets/GcryptMPI.h"
#include "fdosecrets/objects/SessionCipher.h"
#include "fdosecrets/objects/Collection.h"
#include "fdosecrets/objects/Item.h"
#include "crypto/Crypto.h"
@ -90,3 +93,22 @@ void TestFdoSecrets::testDhIetf1024Sha256Aes128CbcPkcs7()
QCOMPARE(cipher->m_aesKey.toHex(), QByteArrayLiteral("6b8f5ee55138eac37118508be21e7834"));
}
void TestFdoSecrets::testCrazyAttributeKey()
{
using FdoSecrets::Item;
using FdoSecrets::Collection;
const QScopedPointer<Group> root(new Group());
const QScopedPointer<Entry> e1(new Entry());
e1->setGroup(root.data());
const QString key = "_a:bc&-+'-e%12df_d";
const QString value = "value";
e1->attributes()->set(key, value);
// search for custom entries
const auto term = Collection::attributeToTerm(key, value);
const auto res = EntrySearcher().search({term}, root.data());
QCOMPARE(res.count(), 1);
}