Skip to content

Commit 3e4ab8b

Browse files
author
aviau
committed
Added test_write_points_bad_precision
1 parent ddb598a commit 3e4ab8b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/influxdb/client_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,25 @@ def test_write_points_with_precision(self):
181181
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
182182
assert cli.write_points_with_precision(data) is True
183183

184+
def test_write_points_bad_precision(self):
185+
data = [
186+
{
187+
"points": [
188+
["1", 1, 1.0],
189+
["2", 2, 2.0]
190+
],
191+
"name": "foo",
192+
"columns": ["column_one", "column_two", "column_three"]
193+
}
194+
]
195+
196+
cli = InfluxDBClient()
197+
with self.assertRaisesRegexp(
198+
Exception,
199+
"Invalid time precision is given. \(use 's', 'm', 'ms' or 'u'\)"
200+
):
201+
cli.write_points_with_precision(data, time_precision='g')
202+
184203
@raises(Exception)
185204
def test_write_points_with_precision_fails(self):
186205
with _mocked_session('post', 500):

0 commit comments

Comments
 (0)