File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 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):
710710
711711 self .assertListEqual (self .cli .get_list_users (), [])
712712
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+
713735 def test_revoke_admin_privileges (self ):
714736 example_response = '{"results":[{}]}'
715737
You can’t perform that action at this time.
0 commit comments