diff options
author | louib <louib@users.noreply.github.com> | 2017-09-06 16:14:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 16:14:41 +0300 |
commit | 6e1fd0694f1013de83fa7cfcf62c527a128a39be (patch) | |
tree | ce208be36debda61db1a0a9643d9994b2867e54f /tests/TestGroup.cpp | |
parent | 1220b7d5017f4b855110e4459aff2ae26e0f34d1 (diff) |
CLI : basic entry manipulation commands. (#919)
* CLI : basic entry manipulation commands.
* Code review.
Diffstat (limited to 'tests/TestGroup.cpp')
-rw-r--r-- | tests/TestGroup.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index efdcb32e6..5a809670f 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -698,3 +698,51 @@ void TestGroup::testLocate() delete db; } + +void TestGroup::testAddEntryWithPath() +{ + Database* db = new Database(); + + Group* group1 = new Group(); + group1->setName("group1"); + group1->setParent(db->rootGroup()); + + Group* group2 = new Group(); + group2->setName("group2"); + group2->setParent(group1); + + Entry* entry = db->rootGroup()->addEntryWithPath("entry1"); + QVERIFY(entry != nullptr); + QVERIFY(!entry->uuid().isNull()); + + entry = db->rootGroup()->addEntryWithPath("entry1"); + QVERIFY(entry == nullptr); + + entry = db->rootGroup()->addEntryWithPath("/entry1"); + QVERIFY(entry == nullptr); + + entry = db->rootGroup()->addEntryWithPath("entry2"); + QVERIFY(entry != nullptr); + QVERIFY(entry->title() == "entry2"); + QVERIFY(!entry->uuid().isNull()); + + entry = db->rootGroup()->addEntryWithPath("/entry3"); + QVERIFY(entry != nullptr); + QVERIFY(entry->title() == "entry3"); + QVERIFY(!entry->uuid().isNull()); + + entry = db->rootGroup()->addEntryWithPath("/group1/entry4"); + QVERIFY(entry != nullptr); + QVERIFY(entry->title() == "entry4"); + QVERIFY(!entry->uuid().isNull()); + + entry = db->rootGroup()->addEntryWithPath("/group1/group2/entry5"); + QVERIFY(entry != nullptr); + QVERIFY(entry->title() == "entry5"); + QVERIFY(!entry->uuid().isNull()); + + entry = db->rootGroup()->addEntryWithPath("/group1/invalid_group/entry6"); + QVERIFY(entry == nullptr); + + delete db; +} |