[gnote] Add test for conflict with deleted note
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add test for conflict with deleted note
- Date: Sun, 21 Oct 2018 15:55:32 +0000 (UTC)
commit df76112cd9387900ea0db9e22ea71ad8494e8517
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Oct 21 17:49:41 2018 +0300
Add test for conflict with deleted note
src/test/unit/syncmanagerutests.cpp | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
---
diff --git a/src/test/unit/syncmanagerutests.cpp b/src/test/unit/syncmanagerutests.cpp
index a9e2c598..7445884b 100644
--- a/src/test/unit/syncmanagerutests.cpp
+++ b/src/test/unit/syncmanagerutests.cpp
@@ -328,5 +328,38 @@ SUITE(SyncManagerTests)
CHECK(!find_note(files, "note2"));
CHECK(find_note(files, "note4"));
}
+
+ TEST_FIXTURE(Fixture, conflict_with_deletion_on_server)
+ {
+ // first sync
+ test::SyncClient::Ptr sync_client1 =
dynamic_pointer_cast<test::SyncClient>(sync_manager1->get_client(manifest1));
+ gnote::sync::SilentUI::Ptr sync_ui1 = gnote::sync::SilentUI::create(*manager1);
+ sync_manager1->perform_synchronization(sync_ui1);
+
+ // sync from existing
+ test::SyncClient::Ptr sync_client2 =
dynamic_pointer_cast<test::SyncClient>(sync_manager2->get_client(manifest2));
+ gnote::sync::SilentUI::Ptr sync_ui2 = gnote::sync::SilentUI::create(*manager2);
+ sync_manager2->perform_synchronization(sync_ui2);
+
+ // remove note
+ auto note = std::dynamic_pointer_cast<test::Note>(manager2->find("note2"));
+ manager2->delete_note(note);
+ note.reset();
+ sync_manager2->perform_synchronization(sync_ui2);
+
+ // update note and sync again
+ note = std::dynamic_pointer_cast<test::Note>(manager1->find("note2"));
+ note->set_xml_content(make_note_content("note4", "updated content"));
+ note->set_change_type(gnote::CONTENT_CHANGED);
+ note->save();
+ sync_client1->reparse();
+ sync_manager1->perform_synchronization(sync_ui1);
+ std::list<Glib::ustring> files;
+ sharp::directory_get_files_with_ext(notesdir1, ".note", files);
+ REQUIRE CHECK_EQUAL(3, files.size()); // 2 downloaded notes + template
+ CHECK(find_note(files, "note1"));
+ CHECK(find_note(files, "note3"));
+ CHECK(!find_note(files, "note2"));
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]