File tree 2 files changed +24
-1
lines changed 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
nose
2
2
mock
3
+ httpretty
Original file line number Diff line number Diff line change 6
6
import requests
7
7
import socket
8
8
import unittest
9
+ import httpretty
9
10
from nose .tools import raises
10
11
from mock import patch
11
12
@@ -331,8 +332,29 @@ def test_delete_database_admin(self):
331
332
def test_get_database_user (self ):
332
333
pass
333
334
335
+ @httpretty .activate
334
336
def test_add_database_user (self ):
335
- pass
337
+ httpretty .register_uri (
338
+ httpretty .POST ,
339
+ "http://localhost:8086/db/db/users"
340
+ )
341
+
342
+ cli = InfluxDBClient (database = 'db' )
343
+ cli .add_database_user (
344
+ new_username = 'paul' ,
345
+ new_password = 'laup' ,
346
+ permissions = ('.*' , '.*' )
347
+ )
348
+
349
+ self .assertEqual (
350
+ httpretty .last_request ().parsed_body ,
351
+ {
352
+ u'writeTo' : u'.*' ,
353
+ u'password' : u'laup' ,
354
+ u'readFrom' : u'.*' ,
355
+ u'name' : u'paul'
356
+ }
357
+ )
336
358
337
359
def test_add_database_user_bad_permissions (self ):
338
360
cli = InfluxDBClient ()
You can’t perform that action at this time.
0 commit comments