Esempio n. 1
0
 def setUp(self):
     self.db_mock = mock.MagicMock(spec=db_store.Obdb)
     data = {
         'datastore': [
             {'key': 'Zurich'.encode('hex')},
             {'key': 'CH'.encode('hex')}
             ]
     }
     self.db_mock.select_entries.side_effect = data.__getitem__
     self.d = datastore.SqliteDataStore(self.db_mock)
Esempio n. 2
0
    def __init__(self, transport, market_id, settings, db_connection):

        self.log = logging.getLogger(
            '[%s] %s' % (market_id, self.__class__.__name__)
        )
        self.settings = settings
        self.known_nodes = []
        self.searches = []
        self.active_peers = []
        self.transport = transport
        self.market_id = market_id

        # Routing table
        self.routing_table = routingtable.OptimizedTreeRoutingTable(
            self.settings['guid'], market_id)
        self.data_store = datastore.SqliteDataStore(db_connection)

        self._lock = RLock()
Esempio n. 3
0
 def setUp(self):
     self.db_mock = mock.MagicMock()
     self.d = datastore.SqliteDataStore(self.db_mock)