コード例 #1
0
ファイル: config.py プロジェクト: GottWall/GottWall
    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')
コード例 #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')
コード例 #3
0
ファイル: api.py プロジェクト: GottWall/GottWall
    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
コード例 #4
0
ファイル: app.py プロジェクト: GottWall/GottWall
    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
コード例 #5
0
    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
コード例 #6
0
    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
コード例 #7
0
ファイル: backends.py プロジェクト: GottWall/GottWall
    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
コード例 #8
0
ファイル: backends.py プロジェクト: Lispython/GottWall
    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
コード例 #9
0
ファイル: runner.py プロジェクト: GottWall/GottWall
    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
コード例 #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")
コード例 #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
コード例 #12
0
ファイル: api.py プロジェクト: Python3pkg/GottWall
    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
コード例 #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
コード例 #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
コード例 #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
コード例 #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