Ejemplo n.º 1
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client)
     app.get('/stats_unique_cell.json', status=200)
Ejemplo n.º 2
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client)
     app.get('/stats_unique_cell.json', status=200)
Ejemplo n.º 3
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db(create=False)
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=get_client('ichnaea'))
     app.get('/stats_location.json', status=200)
Ejemplo n.º 4
0
 def test_redis_config(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client, **settings)
     self.assertTrue(app.app.registry.redis_client is not None)
Ejemplo n.º 5
0
 def test_redis_config(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }
     app = _make_app(_raven_client=self.raven_client,
                     _stats_client=self.stats_client, **settings)
     self.assertTrue(app.app.registry.redis_client is not None)
Ejemplo n.º 6
0
 def test_redis_config(self):
     app_config = DummyConfig({'ichnaea': {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }})
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     self.assertTrue(app.app.registry.redis_client is not None)
Ejemplo n.º 7
0
 def test_db_config(self):
     self.db_rw = _make_db()
     self.db_ro = _make_db()
     self.setup_session()
     app = _make_app(_db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     )
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 8
0
 def test_db_config(self):
     self.db_rw = _make_db()
     self.db_ro = _make_db()
     self.setup_session()
     app = _make_app(_db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 9
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         '_heka_client': self.heka_client,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_unique_cell.json', status=200)
Ejemplo n.º 10
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         '_heka_client': self.heka_client,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_unique_cell.json', status=200)
Ejemplo n.º 11
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     )
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 12
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_master_socket': SQLSOCKET,
         'db_slave': SQLURI,
         'db_slave_socket': SQLSOCKET,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_location.json', status=200)
Ejemplo n.º 13
0
 def test_redis_config(self):
     app_config = DummyConfig({
         'ichnaea': {
             'db_master': SQLURI,
             'db_slave': SQLURI,
             'redis_url': REDIS_URI,
         }
     })
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     self.assertTrue(app.app.registry.redis_client is not None)
Ejemplo n.º 14
0
 def test_db_hooks(self):
     db_rw = _make_db()
     db_ro = _make_db()
     app = _make_app(_db_rw=db_rw,
                     _db_ro=db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     # check that our _db hooks are passed through
     self.assertTrue(app.app.registry.db_rw is db_rw)
     self.assertTrue(app.app.registry.db_ro is db_ro)
Ejemplo n.º 15
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(
         _db_master=self.db_master,
         _db_slave=self.db_slave,
         _heka_client=self.heka_client,
         _stats_client=self.stats_client,
         _redis=self.redis_client,
     )
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 16
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_master_socket': SQLSOCKET,
         'db_slave': SQLURI,
         'db_slave_socket': SQLSOCKET,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_location.json', status=200)
Ejemplo n.º 17
0
 def test_db_hooks(self):
     db_rw = _make_db()
     db_ro = _make_db()
     app = _make_app(_db_rw=db_rw,
                     _db_ro=db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     # check that our _db hooks are passed through
     self.assertTrue(app.app.registry.db_rw is db_rw)
     self.assertTrue(app.app.registry.db_ro is db_ro)
Ejemplo n.º 18
0
 def test_redis_config(self):
     app_config = DummyConfig({"cache": {"cache_url": REDIS_URI}})
     app = _make_app(
         app_config=app_config,
         _db_rw=self.db_rw,
         _db_ro=self.db_ro,
         _raven_client=self.raven_client,
         _stats_client=self.stats_client,
     )
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(redis_client.connection_pool.connection_kwargs["db"], 1)
Ejemplo n.º 19
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     **settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 20
0
 def test_redis_config(self):
     app_config = DummyConfig({'ichnaea': {
         'redis_url': REDIS_URI,
     }})
     app = _make_app(app_config=app_config,
                     _db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(
         redis_client.connection_pool.connection_kwargs['db'], 1)
Ejemplo n.º 21
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     **settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 22
0
 def test_db_hooks(self):
     app_config = DummyConfig({'ichnaea': {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }})
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     self.db_rw = app.app.registry.db_rw
     self.db_ro = app.app.registry.db_ro
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 23
0
 def test_redis_config(self):
     app_config = DummyConfig({
         'cache': {
             'cache_url': REDIS_URI,
         },
     })
     app = _make_app(app_config=app_config,
                     _db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(redis_client.connection_pool.connection_kwargs['db'],
                      1)
Ejemplo n.º 24
0
 def test_db_hooks(self):
     app_config = DummyConfig(
         {'ichnaea': {
             'db_master': SQLURI,
             'db_slave': SQLURI,
         }})
     app = _make_app(
         app_config=app_config,
         _raven_client=self.raven_client,
         _redis_client=self.redis_client,
         _stats_client=self.stats_client,
     )
     self.db_rw = app.app.registry.db_rw
     self.db_ro = app.app.registry.db_ro
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Ejemplo n.º 25
0
 def test_db_config(self):
     app_config = DummyConfig({"database": {"rw_url": SQLURI, "ro_url": SQLURI}})
     app = _make_app(
         app_config=app_config,
         _raven_client=self.raven_client,
         _redis_client=self.redis_client,
         _stats_client=self.stats_client,
     )
     db_rw = app.app.registry.db_rw
     db_ro = app.app.registry.db_ro
     # the configured databases are working
     try:
         self.assertTrue(db_rw.ping())
         self.assertTrue(db_ro.ping())
     finally:
         # clean up the new db engine's _make_app created
         db_rw.engine.pool.dispose()
         db_ro.engine.pool.dispose()
Ejemplo n.º 26
0
 def test_db_config(self):
     app_config = DummyConfig({
         'database': {
             'rw_url': SQLURI,
             'ro_url': SQLURI,
         },
     })
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     db_rw = app.app.registry.db_rw
     db_ro = app.app.registry.db_ro
     # the configured databases are working
     try:
         self.assertTrue(db_rw.ping())
         self.assertTrue(db_ro.ping())
     finally:
         # clean up the new db engine's _make_app created
         db_rw.engine.pool.dispose()
         db_ro.engine.pool.dispose()
Ejemplo n.º 27
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db(create=False)
     self.setup_session()
     app = _make_app(_db_master=self.db_master, _db_slave=self.db_slave)
     app.get('/stats_location.json', status=200)