'Test the dump_collection method
Cases:
1. empty oplog
2. non-empty oplog'

def test_dump_collection(self):

    self.opman1.oplog = self.shard1_conn['test']['emptycollection']
    self.opman2.oplog = self.shard2_conn['test']['emptycollection']
    last_ts1 = self.opman1.dump_collection()
    last_ts2 = self.opman2.dump_collection()
    self.assertEqual(last_ts1, None)
    self.assertEqual(last_ts2, None)
    self.opman1.oplog = self.shard1_conn['local']['oplog.rs']
    self.opman2.oplog = self.shard2_conn['local']['oplog.rs']
    for i in range(1000):
        self.mongos_conn['test']['mcsharded'].insert_one({'i': (i + 500)})
    last_ts1 = self.opman1.get_last_oplog_timestamp()
    last_ts2 = self.opman2.get_last_oplog_timestamp()
    self.assertEqual(last_ts1, self.opman1.dump_collection())
    self.assertEqual(last_ts2, self.opman2.dump_collection())
    self.assertEqual(len(self.opman1.doc_managers[0]._search()), 1000)
