def get_app(self): cfg = get_config(CACHE_IMPLEMENTATION_CLASS='cyclops.cache.RedisCache', REDIS_HOST='localhost', REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None) return CyclopsApp(config=cfg)
def get_app(self): cfg = get_config( CACHE_IMPLEMENTATION_CLASS="cyclops.cache.RedisCache", REDIS_HOST="localhost", REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None, ) return CyclopsApp(config=cfg)
def test_configure_app_to_FifoQueue(): cfg = get_config(PROCESS_NEWER_MESSAGES_FIRST=False) loop = FakeLoop() app = App(config=cfg, debug=True, main_loop=loop, configure=True) expect(app.storage.items_to_process).to_be_instance_of(defaultdict) expect(app.storage.items_to_process.default_factory).to_equal(Queue) forget()
def test_redis_storage_fails_if_not_configured_properly(): cfg = get_config(REDIS_HOST=None, REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None) app = App(config=cfg) try: RedisStorage(app) except RuntimeError, err: msg = "If you are using RedisStorage you need to set in your configuration file " \ "the following keys: REDIS_HOST, REDIS_PORT, REDIS_DB_COUNT and REDIS_PASSWORD(optional)" expect(err).to_have_an_error_message_of(msg) return
def get_app(self): cfg = get_config( CACHE_IMPLEMENTATION_CLASS='cyclops.cache.RedisCache', REDIS_HOST='localhost', REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None ) self.app = CyclopsApp(config=cfg) return self.app
def test_redis_storage_fails_if_not_configured_properly(): cfg = get_config(REDIS_HOST=None, REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None) app = App(config=cfg) try: RedisStorage(app) except RuntimeError, err: msg = ( "If you are using RedisStorage you need to set in your configuration file " "the following keys: REDIS_HOST, REDIS_PORT, REDIS_DB_COUNT and REDIS_PASSWORD(optional)" ) expect(err).to_have_an_error_message_of(msg) return
def test_configure_app(): cfg = get_config() loop = FakeLoop() app = App(config=cfg, debug=True, main_loop=loop, configure=True) handlers = app.get_handlers() expect(app.main_loop).to_equal(loop) expect(app.config).to_equal(cfg) expect(handlers).to_length(4) expect(handlers[0].name).to_equal('router') expect(handlers[1].name).to_equal('router_post') expect(handlers[2].name).to_equal('count') expect(handlers[3].name).to_equal('healthcheck') expect(app.cache).to_be_instance_of(RedisCache) expect(app.cache.application).to_equal(app) expect(app.storage).to_be_instance_of(InMemoryStorage) expect(app.storage.application).to_equal(app) expect(app.storage.items_to_process).to_be_instance_of(defaultdict) expect(app.storage.items_to_process.default_factory).to_equal(LifoQueue) expect(app.project_keys).to_length(1) expect(app.processed_items).to_equal(0) expect(app.ignored_items).to_equal(0) expect(app.last_requests).to_be_empty() expect(app.average_request_time).to_be_null() expect(app.percentile_request_time).to_be_null() expect(cfg.NUMBER_OF_FORKS).to_equal(1) forget()
def _build(cls, model_class, config=None, *args, **kwargs): config = module_config or config or helpers.get_config() return model_class(config=config, *args, **kwargs)
def get_app(self): cfg = get_config() return CyclopsApp(config=cfg, main_loop=IOLoop.current())
def get_app(): cfg = get_config(REDIS_HOST="localhost", REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None) return App(config=cfg)
def get_app(): cfg = get_config(REDIS_HOST='localhost', REDIS_PORT=7780, REDIS_DB_COUNT=0, REDIS_PASSWORD=None) return App(config=cfg)