def test_setup(self): with app.app_context(): influx.setup() db = InfluxDBClient('influxdb', 8086, 'root', 'root', self.get_db_name()) dbs = [ entry for entry in db.get_list_database() if entry['name'] == self.get_db_name() ] self.assertGreater(len(dbs), 0)
def tearDown(self): with app.app_context(): influx.teardown()
def setUp(self): with app.app_context(): influx.setup()
def test_save(self): with app.app_context(): events.save({'type': 'exercise', 'value': 8.0})
def test_missing_value(self): with app.app_context(): with self.assertRaises(AssertionError): events.save({'type': 'exercise'})
def test_missing_type(self): with app.app_context(): with self.assertRaises(AssertionError): events.save({'value': 8.0})
def test_connection_cached(self): with app.app_context(): db1 = influx.get_db() db2 = influx.get_db() self.assertEqual(db1, db2)
def test_get_connection(self): with app.app_context(): db = influx.get_db() self.assertTrue(isinstance(db, InfluxDBClient))