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.
This commit is contained in:
Patrick Ohly 2012-08-31 19:09:02 +00:00
parent 000e1e3fd6
commit dc50fa5b51

View file

@ -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<<REVISION>>");
}
}
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<<REVISION>>");
}
testAddBothSidesFixUpdateItem(updateItem);
// insert initial item data on B
CT_ASSERT_NO_THROW(accessClientB->sources[0].second->insert(accessClientB->sources[0].second->createSourceA,