'Test the get_last_oplog_timestamp method'

def test_get_last_oplog_timestamp(self):

    self.opman1.oplog = self.shard1_conn['test']['emptycollection']
    self.opman2.oplog = self.shard2_conn['test']['emptycollection']
    self.assertEqual(self.opman1.get_last_oplog_timestamp(), None)
    self.assertEqual(self.opman2.get_last_oplog_timestamp(), 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)})
    oplog1 = self.shard1_conn['local']['oplog.rs']
    oplog1 = oplog1.find().sort('$natural', pymongo.DESCENDING).limit((-1))[0]
    oplog2 = self.shard2_conn['local']['oplog.rs']
    oplog2 = oplog2.find().sort('$natural', pymongo.DESCENDING).limit((-1))[0]
    self.assertEqual(self.opman1.get_last_oplog_timestamp(), oplog1['ts'])
    self.assertEqual(self.opman2.get_last_oplog_timestamp(), oplog2['ts'])
