Beispiel #1
0
    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')
Beispiel #2
0
    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')
Beispiel #3
0
    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
Beispiel #4
0
    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_object(gottwall.default_config)

        config.update({"STORAGE_SETTINGS": {
            "HOST": self.redis_settings['HOST']
            }})

        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({"BACKENDS": {"gw_backend_redis.backend.RedisBackend": {"HOST": HOST}},
                       "STORAGE": "gottwall.storages.MemoryStorage",
                       "REDIS_HOST": HOST,
                       "PROJECTS": {"test_project": "secretkey2"},
                       "SECRET_KEY": "myprivatekey2"})
        app = AggregatorApplication(config)
        app.configure_app(self.io_loop)
        return app
Beispiel #7
0
    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
Beispiel #8
0
    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.app = AggregatorApplication(config)
        self.app.configure_app(self.io_loop)

        return self.app
Beispiel #9
0
    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
Beispiel #10
0
    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")
Beispiel #11
0
    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
Beispiel #12
0
    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
Beispiel #13
0
    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
Beispiel #14
0
    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
Beispiel #15
0
    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
Beispiel #16
0
    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