'Test read_oplog_progress'

def test_read_oplog_progress(self):

    conn = Connector(mongo_address=self.repl_set.uri, oplog_checkpoint=None, **connector_opts)
    self.assertEqual(conn.read_oplog_progress(), None)
    try:
        os.unlink('temp_oplog.timestamp')
    except OSError:
        pass
    open('temp_oplog.timestamp', 'w').close()
    conn.oplog_checkpoint = 'temp_oplog.timestamp'
    self.assertEqual(conn.read_oplog_progress(), None)
    oplog_dict = conn.oplog_progress.get_dict()
    oplog_dict['oplog1'] = Timestamp(12, 34)
    conn.write_oplog_progress()
    del oplog_dict['oplog1']
    self.assertEqual(len(oplog_dict), 0)
    conn.read_oplog_progress()
    oplog_dict = conn.oplog_progress.get_dict()
    self.assertTrue(('oplog1' in oplog_dict.keys()))
    self.assertTrue(oplog_dict['oplog1'], Timestamp(12, 34))
    oplog_dict['oplog1'] = Timestamp(55, 11)
    conn.read_oplog_progress()
    self.assertTrue(oplog_dict['oplog1'], Timestamp(55, 11))
    os.unlink('temp_oplog.timestamp')
