def setUp(self):
     super().setUp()
     self.environ_dict = {'TRAM_ROOT': 'mock_value'}
     self.os_environ_mock = patch.dict('db.mpk.os.environ',
                                       self.environ_dict).start()
     self.sqlite_mock = patch('db.mpk.sqlite3').start()
     self.mock_db_connection = MagicMock()
     self.mock_db_cursor = MagicMock()
     self.mock_db_connection.cursor.return_value = self.mock_db_cursor
     self.sqlite_mock.connect.return_value = self.mock_db_connection
     self.mpk = MpkDb()
Exemple #2
0
 def __init__(self):
     self.number = 1
     self.db_file = os.environ['TRAM_ROOT'] + '/data/'
     self.config = Config()
     self.db = MpkDb()
     self.przystanki_db = PrzystankiDb()
     self.przystanki = Przystanki()
     self.tramwaje = []
     self.nowe_tramwaje = []
     self.factorio = TramwajFactory()
     YieldPeriodicCallback.__init__(self, self.run, 60000, faststart=True)
     logging.info('SpawnWorker initialised')
Exemple #3
0
    def __init__(self):
        self.number = 1
        self.last_db_update = None
        self.db_file = os.environ['TRAM_ROOT'] + '/data/'
        self.config = Config()
        self.force_update = False
        self.status = [('not running', str(datetime.datetime.now()))]

        self.db = MpkDb()
        self.przystanki_db = PrzystankiDb()
        self.mpk_link = self.config['get_db_link']
        self.mpk_point_data = self.config['get_point_data_link']
        self.headers = self.config['mpk_headers']
        self.httpclient = AsyncHTTPClient()
        YieldPeriodicCallback.__init__(self,
                                       self.run,
                                       self.config['ttworker_refresh_period'] *
                                       60000,
                                       faststart=True)
        self.update_status('TTworker initialised')
 def __init__(self):
     self.mpk_db = MpkDb()