Skip to content

Commit 50ce30d

Browse files
author
aviau
committed
Added test_get_database_users
1 parent 3b2c262 commit 50ce30d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/influxdb/client_test.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,22 @@ def test_delete_database_admin(self):
386386
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
387387
cli.delete_database_admin('admin')
388388

389-
def test_get_database_user(self):
390-
pass
389+
def test_get_database_users(self):
390+
cli = InfluxDBClient('localhost', 8086, 'username', 'password', 'db')
391+
392+
example_response = \
393+
'[{"name":"paul","isAdmin":false,"writeTo":".*","readFrom":".*"},' \
394+
'{"name":"bobby","isAdmin":false,"writeTo":".*","readFrom":".*"}]'
395+
396+
with requests_mock.Mocker() as m:
397+
m.register_uri(
398+
requests_mock.GET,
399+
"http://localhost:8086/db/db/users",
400+
text=example_response
401+
)
402+
users = cli.get_database_users()
403+
404+
self.assertEqual(json.loads(example_response), users)
391405

392406
def test_add_database_user(self):
393407
with requests_mock.Mocker() as m:

0 commit comments

Comments
 (0)