def setUp(self): if not FLAGS.verbose_tests: logging.disable(logging.CRITICAL) self.db = sqlite_log_db.SQLiteLogDB( sqlitecon.SQLiteConnectionManager(":memory:", keepalive=True)) # We can't simply use DB in memory with keepalive True, because different # thread is writing to the database which results in an sqlite exception. self.cert_db = mock.MagicMock() self.state_keeper = InMemoryStateKeeper( copy.deepcopy(self._DEFAULT_STATE)) self.verifier = mock.Mock() self.hasher = merkle.TreeHasher() # Make sure the DB knows about the default log server. log = client_pb2.CtLogMetadata() log.log_server = "log_server" self.db.add_log(log)
sys.argv = FLAGS(sys.argv) logging.basicConfig(level=FLAGS.log_level) create_directory(FLAGS.ct_sqlite_temp_dir) create_directory(FLAGS.monitor_state_dir) try: list_ = requests.get(tld_list.TLD_LIST_ADDR, timeout=5) if list_.status_code == 200: create_directory(FLAGS.tld_list_dir) with open('/'.join((FLAGS.tld_list_dir, "tld_list")), 'w') as f: f.write(list_.content) except requests.exceptions.RequestException: logging.warning("Couldn't fetch top level domain list") sqlite_log_db = sqlite_log_db.SQLiteLogDB( sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_db)) sqlite_temp_db_factory = sqlite_temp_db.SQLiteTempDBFactory( sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_temp_dir + "/meta"), FLAGS.ct_sqlite_temp_dir) sqlite_cert_db = sqlite_cert_db.SQLiteCertDB( sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_cert_db)) ctlogs = client_pb2.CtLogs() with open(FLAGS.ctlog_config, "r") as config: log_config = config.read() text_format.Merge(log_config, ctlogs) ct_server_list = [] for log in ctlogs.ctlog:
def setUp(self): self.database = sqlite_log_db.SQLiteLogDB( sqlitecon.SQLiteConnectionManager(":memory:", keepalive=True))