File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -710,6 +710,28 @@ def test_get_list_users_empty(self):
710
710
711
711
self .assertListEqual (self .cli .get_list_users (), [])
712
712
713
+ def test_grant_admin_privileges (self ):
714
+ example_response = '{"results":[{}]}'
715
+
716
+ with requests_mock .Mocker () as m :
717
+ m .register_uri (
718
+ requests_mock .GET ,
719
+ "http://localhost:8086/query" ,
720
+ text = example_response
721
+ )
722
+ self .cli .grant_admin_privileges ('test' )
723
+
724
+ self .assertEqual (
725
+ m .last_request .qs ['q' ][0 ],
726
+ 'grant all privileges to test'
727
+ )
728
+
729
+ @raises (Exception )
730
+ def test_grant_admin_privileges_invalid (self ):
731
+ cli = InfluxDBClient ('host' , 8086 , 'username' , 'password' )
732
+ with _mocked_session (cli , 'get' , 400 ):
733
+ self .cli .grant_admin_privileges ('' )
734
+
713
735
def test_revoke_admin_privileges (self ):
714
736
example_response = '{"results":[{}]}'
715
737
You can’t perform that action at this time.
0 commit comments