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-12-18 00:34:07 +0300
committerJonathan White <support@dmapps.us>2020-01-02 16:04:42 +0300
commitaf14929af1657796e3dc8369442079126ce2ef11 (patch)
tree68f4014616615cc3bb115597fb2d908277f74a44 /tests
parent3ffeab4c41ac79a5426e1736301f979ae4abe41f (diff)
FdoSecrets: fix searching of entries with special characters in attributes
Diffstat (limited to 'tests')
-rw-r--r--tests/TestFdoSecrets.cpp32
-rw-r--r--tests/TestFdoSecrets.h1
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/TestFdoSecrets.cpp b/tests/TestFdoSecrets.cpp
index 30d8da5c7..299c3f7bf 100644
--- a/tests/TestFdoSecrets.cpp
+++ b/tests/TestFdoSecrets.cpp
@@ -112,3 +112,35 @@ void TestFdoSecrets::testCrazyAttributeKey()
const auto res = EntrySearcher().search({term}, root.data());
QCOMPARE(res.count(), 1);
}
+
+void TestFdoSecrets::testSpecialCharsInAttributeValue()
+{
+ using FdoSecrets::Collection;
+ using FdoSecrets::Item;
+
+ const QScopedPointer<Group> root(new Group());
+ QScopedPointer<Entry> e1(new Entry());
+ e1->setGroup(root.data());
+
+ e1->setTitle("titleA");
+ e1->attributes()->set("testAttribute", "OAuth::[test.name@gmail.com]");
+
+ QScopedPointer<Entry> e2(new Entry());
+ e2->setGroup(root.data());
+ e2->setTitle("titleB");
+ e2->attributes()->set("testAttribute", "Abc:*+.-");
+
+ // search for custom entries via programatic API
+ {
+ const auto term = Collection::attributeToTerm("testAttribute", "OAuth::[test.name@gmail.com]");
+ const auto res = EntrySearcher().search({term}, root.data());
+ QCOMPARE(res.count(), 1);
+ QCOMPARE(res[0]->title(), QStringLiteral("titleA"));
+ }
+ {
+ const auto term = Collection::attributeToTerm("testAttribute", "Abc:*+.-");
+ const auto res = EntrySearcher().search({term}, root.data());
+ QCOMPARE(res.count(), 1);
+ QCOMPARE(res[0]->title(), QStringLiteral("titleB"));
+ }
+}
diff --git a/tests/TestFdoSecrets.h b/tests/TestFdoSecrets.h
index e108a81b9..1cecbbeac 100644
--- a/tests/TestFdoSecrets.h
+++ b/tests/TestFdoSecrets.h
@@ -31,6 +31,7 @@ private slots:
void testGcryptMPI();
void testDhIetf1024Sha256Aes128CbcPkcs7();
void testCrazyAttributeKey();
+ void testSpecialCharsInAttributeValue();
};
#endif // KEEPASSXC_TESTFDOSECRETS_H