'Test memory limit as well as simple flush'

def testMemoryLimit(self):

    trManager = TransactionManager(timedelta(seconds=0), MAX_QUEUE_SIZE, timedelta(seconds=0), max_endpoint_errors=100)
    step = 10
    oneTrSize = ((MAX_QUEUE_SIZE / step) - 1)
    for i in xrange(step):
        trManager.append(memTransaction(oneTrSize, trManager))
    trManager.flush()
    self.assertEqual(len(trManager._transactions), step)
    for tr in trManager._transactions:
        self.assertEqual(tr._flush_count, 1)
    trManager.append(memTransaction((oneTrSize + 10), trManager))
    self.assertEqual(len(trManager._transactions), step)
    for tr in trManager._transactions:
        self.assertNotEqual(tr._id, 1)
    trManager.flush()
    self.assertEqual(len(trManager._transactions), step)
    for tr in trManager._transactions:
        tr.is_flushable = True
        if (tr._id == (step + 1)):
            self.assertEqual(tr._flush_count, 1)
        else:
            self.assertEqual(tr._flush_count, 2)
    trManager.flush()
    self.assertEqual(len(trManager._transactions), 0)
