From dc50fa5b5111e42c83b60f18de1b42069bddbb35 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 31 Aug 2012 19:09:02 +0000 Subject: [PATCH] testing: fixed testAddBothSides* Both testAddBothSides* tests need similar patching of the test data. The second version of that code was incomplete. Fixed by moving into a common method. --- test/ClientTest.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp index 6f039797..48dd93bb 100644 --- a/test/ClientTest.cpp +++ b/test/ClientTest.cpp @@ -4677,14 +4677,8 @@ bool addBothSidesAddStatsBroken = false; // duplicates itself; the client needs to do that bool addBothSidesServerIsDumb = getenv("CLIENT_TEST_ADD_BOTH_SIDES_SERVER_IS_DUMB") != NULL; -void SyncTests::testAddBothSides() +static void testAddBothSidesFixUpdateItem(std::string &updateItem) { - CT_ASSERT_NO_THROW(deleteAll()); - accessClientB->deleteAll(); - - std::string insertItem = sources[0].second->config.m_insertItem; - std::string updateItem = sources[0].second->config.m_updateItem; - if (addBothSidesNoMergeLines) { // VEVENT boost::replace_all(updateItem, "LOCATION:big meeting room", "LOCATION:my office"); @@ -4694,6 +4688,16 @@ void SyncTests::testAddBothSides() // VTODO boost::replace_all(updateItem, "DESCRIPTION:to be done", "DESCRIPTION:to be done<>"); } +} + +void SyncTests::testAddBothSides() +{ + CT_ASSERT_NO_THROW(deleteAll()); + accessClientB->deleteAll(); + + std::string insertItem = sources[0].second->config.m_insertItem; + std::string updateItem = sources[0].second->config.m_updateItem; + testAddBothSidesFixUpdateItem(updateItem); CT_ASSERT_NO_THROW(sources[0].second->insert(sources[0].second->createSourceA, insertItem)); @@ -4791,11 +4795,7 @@ void SyncTests::testAddBothSidesRefresh() std::string insertItem = sources[0].second->config.m_insertItem; std::string updateItem = sources[0].second->config.m_updateItem; - - if (addBothSidesNoMergeLines) { - boost::replace_all(updateItem, "LOCATION:big meeting room", "LOCATION:my office"); - boost::replace_all(updateItem, "DESCRIPTION:nice to see you", "DESCRIPTION:let's talk<>"); - } + testAddBothSidesFixUpdateItem(updateItem); // insert initial item data on B CT_ASSERT_NO_THROW(accessClientB->sources[0].second->insert(accessClientB->sources[0].second->createSourceA,