File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,25 @@ def test_get_list_cluster_admins(self):
293
293
pass
294
294
295
295
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
+ )
297
315
298
316
def test_update_cluster_admin_password (self ):
299
317
with requests_mock .Mocker () as m :
@@ -314,7 +332,17 @@ def test_update_cluster_admin_password(self):
314
332
)
315
333
316
334
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 )
318
346
319
347
def test_set_database_admin (self ):
320
348
pass
You can’t perform that action at this time.
0 commit comments