예제 #1
0
 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)
예제 #2
0
 def tearDown(self):
     with app.app_context():
         influx.teardown()
예제 #3
0
 def setUp(self):
     with app.app_context():
         influx.setup()
예제 #4
0
 def test_save(self):
     with app.app_context():
         events.save({'type': 'exercise', 'value': 8.0})
예제 #5
0
 def test_missing_value(self):
     with app.app_context():
         with self.assertRaises(AssertionError):
             events.save({'type': 'exercise'})
예제 #6
0
 def test_missing_type(self):
     with app.app_context():
         with self.assertRaises(AssertionError):
             events.save({'value': 8.0})
예제 #7
0
 def test_connection_cached(self):
     with app.app_context():
         db1 = influx.get_db()
         db2 = influx.get_db()
         self.assertEqual(db1, db2)
예제 #8
0
 def test_get_connection(self):
     with app.app_context():
         db = influx.get_db()
         self.assertTrue(isinstance(db, InfluxDBClient))