def setup_class(cls): cls.krakens_pool = {} logging.info("Initing the tests {}, let's pop the krakens".format( cls.__name__)) cls.launch_all_krakens() cls.create_dummy_ini() i_manager = InstanceManager() i_manager.initialisation(start_ping=False) #we block the stat manager not to send anything to rabbit mq def mock_publish(self, stat): pass #we don't want to initialize rabbit for test. def mock_init(): pass StatManager.publish_request = mock_publish StatManager._init_rabbitmq = mock_init #we don't want to have anything to do with the jormun database either class bob: @classmethod def mock_get_token(cls, token, valid_until): #note, since get_from_token is a class method, we need to wrap it. #change that with a real mock framework pass User.get_from_token = bob.mock_get_token
def setup(cls): cls.krakens_pool = {} logging.info("Initing the tests {}, let's pop the krakens".format( cls.__name__)) cls.launch_all_krakens() cls.create_dummy_ini() i_manager = InstanceManager() i_manager.initialisation(start_ping=False)
rest_api = Api(app, catch_all_404s=True, serve_challenge_on_401=True) from navitiacommon.models import db db.init_app(app) cache = Cache(app, config=app.config['CACHE_CONFIGURATION']) if app.config['AUTOCOMPLETE'] is not None: global_autocomplete = utils.create_object(app.config['AUTOCOMPLETE']['class_path'], **app.config['AUTOCOMPLETE']['kwargs']) else: global_autocomplete = None from jormungandr.instance_manager import InstanceManager i_manager = InstanceManager(instances_dir=app.config.get('INSTANCES_DIR', None), start_ping=app.config.get('START_MONITORING_THREAD', True)) i_manager.initialisation() from jormungandr.stat_manager import StatManager stat_manager = StatManager() from jormungandr.parking_space_availability.bss.bss_provider_manager import BssProviderManager bss_provider_manager = BssProviderManager(app.config['BSS_PROVIDER']) from jormungandr import api def setup_package(): i_manager.stop()
k: utils.create_object(v) for k, v in app.config[str('AUTOCOMPLETE_SYSTEMS')].items() } else: from jormungandr.autocomplete.kraken import Kraken global_autocomplete = {'kraken': Kraken()} streetnetwork_backend_manager = init.street_network_backends(app) from jormungandr.instance_manager import InstanceManager i_manager = InstanceManager( streetnetwork_backend_manager, instances_dir=app.config.get(str('INSTANCES_DIR'), None), instance_filename_pattern=app.config.get(str('INSTANCES_FILENAME_PATTERN'), '*.json'), start_ping=app.config.get(str('START_MONITORING_THREAD'), True), ) i_manager.initialisation() from jormungandr.stat_manager import StatManager stat_manager = StatManager() bss_provider_manager = init.bss_providers(app) from jormungandr.parking_space_availability.car.car_park_provider_manager import CarParkingProviderManager car_park_provider_manager = CarParkingProviderManager( app.config[str('CAR_PARK_PROVIDER')])
app.wsgi_app = ReverseProxied(app.wsgi_app) got_request_exception.connect(log_exception, app) rest_api = Api(app, catch_all_404s=True) from navitiacommon.models import db db.init_app(app) if not app.config['CACHE_DISABLED']: from navitiacommon.cache import init_cache init_cache(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'], db=app.config['REDIS_DB'], password=app.config['REDIS_PASSWORD'], default_ttl=app.config['AUTH_CACHE_TTL']) from jormungandr.instance_manager import InstanceManager i_manager = InstanceManager() i_manager.initialisation(start_ping=app.config['START_MONITORING_THREAD']) from jormungandr.stat_manager import StatManager stat_manager = StatManager() from jormungandr import api def setup_package(): i_manager.stop()
if app.config['AUTOCOMPLETE_SYSTEMS'] is not None: global_autocomplete = { k: utils.create_object(v) for k, v in app.config['AUTOCOMPLETE_SYSTEMS'].items() } else: from jormungandr.autocomplete.kraken import Kraken global_autocomplete = {'kraken': Kraken()} from jormungandr.instance_manager import InstanceManager i_manager = InstanceManager( instances_dir=app.config.get('INSTANCES_DIR', None), instance_filename_pattern=app.config.get('INSTANCES_FILENAME_PATTERN', '*.json'), start_ping=app.config.get('START_MONITORING_THREAD', True), ) i_manager.initialisation() from jormungandr.stat_manager import StatManager stat_manager = StatManager() bss_provider_manager = init.bss_providers(app) from jormungandr.parking_space_availability.car.car_park_provider_manager import CarParkingProviderManager car_park_provider_manager = CarParkingProviderManager( app.config['CAR_PARK_PROVIDER']) from jormungandr import api