예제 #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
    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
    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