def get_app(self): config = Config() config.from_module(gottwall.default_config) config.update() self.app = HTTPApplication(config) self.app.configure_app(tornado.ioloop.IOLoop.instance()) return self.app
def test_load(self): config = Config() filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), "config_file.py") config.from_file(filename) self.assertTrue(config['SOME_TEST_VAR'], 'some_test_value')
def get_app(self): config = Config() config.from_module(gottwall.default_config) config.update({"BACKENDS": []}) self.app = HTTPApplication(config) self.app.configure_app(self.io_loop) return self.app
def get_app(self): config = Config() config.from_module(gottwall.default_config) config.update({ "TASKS_CHUNK": 15, "BACKENDS": { "gottwall.backends.tcpip.TCPIPBackend": { "PORT": get_unused_port() } } }) app = AggregatorApplication(config) app.configure_app(tornado.ioloop.IOLoop().instance()) return app
def get_app(self): config = Config() config.from_module(gottwall.default_config) config.update({ "BACKENDS": { "gottwall.backends.http.HTTPBackend": { "PORT": get_unused_port() } }, "PROJECTS": { "test_project": "secretkey" }, "SECRET_KEY": "myprivatekey" }) self.aggregator = AggregatorApplication(config) self.aggregator.configure_app(self.io_loop) return self.aggregator.backends[0].web_application
def run(self, options, args): """Prepare env befor command execution :param options: options object :param args: list or commandor args """ if not options.config: return False config = Config() # Load default config config.from_module(gottwall.default_config) # Rewrite default settings config.from_file(options.config) return config
def get_app(self): config = Config() config.from_module(gottwall.default_config) config.update({ "BACKENDS": { "gottwall.backends.tcpip.TCPIPBackend": { "PORT": get_unused_port() } }, "STORAGE": "gottwall.storages.MemoryStorage", "PROJECTS": { "test_project": "secretkey" }, "PRIVATE_KEY": "myprivatekey" }) self.app = AggregatorApplication(config) self.app.configure_app(self.io_loop) return self.app
def test_base_storage(self): config = Config() config.from_object(gottwall.default_config) app = HTTPApplication(config) app.configure_storage("gottwall.storages.BaseStorage") self.assertTrue(isinstance(app.storage, BaseStorage)) params = { "project": "project_name", "name": "orders", "timestamp": datetime.datetime.now(), "filters": { "clearing": True, "device": "web" } } self.assertRaises(NotImplementedError, app.storage.incr, **params) self.assertRaises(NotImplementedError, app.storage.decr, **params) self.assertRaises(NotImplementedError, app.storage.metrics, "project_name") res = app.storage.make_embedded("project", "month", self.get_embedded_metrics()) self.assertTrue(isinstance(res[0], UUID)) self.assertEquals(res[1]['project'], "project") self.assertEquals(res[1]['period'], "month") self.assertEquals(len(res[1]['metrics']), len(self.get_embedded_metrics())) self.assertRaises(NotImplementedError, app.storage.query, "test_project", "test_metric", "month") self.assertRaises(NotImplementedError, app.storage.metrics, "test_project") self.assertRaises(NotImplementedError, app.storage.get_filters, "test_project", "test_metric") self.assertRaises(NotImplementedError, app.storage.get_filter_values, "test_project", "test_metric", "filter1")