Skip to content

Commit fb67cbe

Browse files
committed
add tests for get_database_list method
1 parent 2e74399 commit fb67cbe

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/influxdb/client_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ def test_delete_database_fails(self):
143143
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
144144
cli.delete_database('old_db')
145145

146+
def test_get_database_list(self):
147+
with patch.object(session, 'get') as mocked_get:
148+
mocked_get.return_value = _build_response_object(
149+
status_code=200, content='[{"name": "a_db"}]')
150+
cli = InfluxDBClient('host', 8086, 'username', 'password')
151+
assert len(cli.get_database_list()) == 1
152+
assert cli.get_database_list()[0]['name'] == 'a_db'
153+
154+
@raises(Exception)
155+
def test_get_database_list_fails(self):
156+
with patch.object(session, 'get') as mocked_get:
157+
mocked_get.return_value = _build_response_object(status_code=401)
158+
cli = InfluxDBClient('host', 8086, 'username', 'password')
159+
cli.get_database_list()
160+
146161
def test_get_list_cluster_admins(self):
147162
pass
148163

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy