|
9 | 9 | import requests_mock
|
10 | 10 | from nose.tools import raises
|
11 | 11 | from mock import patch
|
| 12 | +import warnings |
12 | 13 |
|
13 | 14 | from influxdb import InfluxDBClient
|
14 | 15 | from influxdb.client import session
|
@@ -61,6 +62,9 @@ def request(*args, **kwargs):
|
61 | 62 | class TestInfluxDBClient(unittest.TestCase):
|
62 | 63 |
|
63 | 64 | def setUp(self):
|
| 65 | + # By default, ignore warnings |
| 66 | + warnings.simplefilter('ignore', FutureWarning) |
| 67 | + |
64 | 68 | self.dummy_points = [
|
65 | 69 | {
|
66 | 70 | "points": [
|
@@ -308,20 +312,31 @@ def test_delete_database_fails(self):
|
308 | 312 | cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
309 | 313 | cli.delete_database('old_db')
|
310 | 314 |
|
311 |
| - def test_get_database_list(self): |
| 315 | + def test_get_list_database(self): |
312 | 316 | data = [
|
313 | 317 | {"name": "a_db"}
|
314 | 318 | ]
|
315 | 319 | with _mocked_session('get', 200, data):
|
316 | 320 | cli = InfluxDBClient('host', 8086, 'username', 'password')
|
317 | 321 | assert len(cli.get_database_list()) == 1
|
318 |
| - assert cli.get_database_list()[0]['name'] == 'a_db' |
| 322 | + assert cli.get_list_database()[0]['name'] == 'a_db' |
319 | 323 |
|
320 | 324 | @raises(Exception)
|
321 |
| - def test_get_database_list_fails(self): |
| 325 | + def test_get_list_database_fails(self): |
322 | 326 | with _mocked_session('get', 401):
|
323 | 327 | cli = InfluxDBClient('host', 8086, 'username', 'password')
|
324 |
| - cli.get_database_list() |
| 328 | + cli.get_list_database() |
| 329 | + |
| 330 | + @raises(FutureWarning) |
| 331 | + def test_get_database_list_deprecated(self): |
| 332 | + warnings.simplefilter('error', FutureWarning) |
| 333 | + data = [ |
| 334 | + {"name": "a_db"} |
| 335 | + ] |
| 336 | + with _mocked_session('get', 200, data): |
| 337 | + cli = InfluxDBClient('host', 8086, 'username', 'password') |
| 338 | + assert len(cli.get_database_list()) == 1 |
| 339 | + assert cli.get_database_list()[0]['name'] == 'a_db' |
325 | 340 |
|
326 | 341 | def test_delete_series(self):
|
327 | 342 | with _mocked_session('delete', 204):
|
|
0 commit comments