Skip to content

Commit 9d980a8

Browse files
author
aviau
committed
Added tests for add and delete_cluster_admins
1 parent eb860ed commit 9d980a8

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

tests/influxdb/client_test.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,25 @@ def test_get_list_cluster_admins(self):
293293
pass
294294

295295
def test_add_cluster_admin(self):
296-
pass
296+
with requests_mock.Mocker() as m:
297+
m.register_uri(
298+
requests_mock.POST,
299+
"http://localhost:8086/cluster_admins"
300+
)
301+
302+
cli = InfluxDBClient(database='db')
303+
cli.add_cluster_admin(
304+
new_username='paul',
305+
new_password='laup'
306+
)
307+
308+
self.assertDictEqual(
309+
json.loads(m.last_request.body),
310+
{
311+
'name': 'paul',
312+
'password': 'laup'
313+
}
314+
)
297315

298316
def test_update_cluster_admin_password(self):
299317
with requests_mock.Mocker() as m:
@@ -314,7 +332,17 @@ def test_update_cluster_admin_password(self):
314332
)
315333

316334
def test_delete_cluster_admin(self):
317-
pass
335+
with requests_mock.Mocker() as m:
336+
m.register_uri(
337+
requests_mock.DELETE,
338+
"http://localhost:8086/cluster_admins/paul",
339+
status_code=204,
340+
)
341+
342+
cli = InfluxDBClient(database='db')
343+
cli.delete_cluster_admin(username='paul')
344+
345+
self.assertIsNone(m.last_request.body)
318346

319347
def test_set_database_admin(self):
320348
pass

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