Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAetf <aetf@unlimitedcodeworks.xyz>2019-11-01 23:42:00 +0300
committerJonathan White <support@dmapps.us>2019-11-09 01:37:50 +0300
commitf9097c84e969b7a88829eb67d8d2496b8e2f6e3f (patch)
treee041b251fd6d9e77b3e8a5e11cf026085935838f /tests
parentb96c1e92a31ac565f406251d4f386d042519c558 (diff)
FdoSecrets: use EntrySearcher's internal search API
Diffstat (limited to 'tests')
-rw-r--r--tests/TestFdoSecrets.cpp22
-rw-r--r--tests/TestFdoSecrets.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/TestFdoSecrets.cpp b/tests/TestFdoSecrets.cpp
index 3876f9033..6994f60ab 100644
--- a/tests/TestFdoSecrets.cpp
+++ b/tests/TestFdoSecrets.cpp
@@ -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);
+}
diff --git a/tests/TestFdoSecrets.h b/tests/TestFdoSecrets.h
index eecc687e4..e108a81b9 100644
--- a/tests/TestFdoSecrets.h
+++ b/tests/TestFdoSecrets.h
@@ -30,6 +30,7 @@ private slots:
void testGcryptMPI();
void testDhIetf1024Sha256Aes128CbcPkcs7();
+ void testCrazyAttributeKey();
};
#endif // KEEPASSXC_TESTFDOSECRETS_H