Skip to content

Commit a52f419

Browse files
author
aviau
committed
Added test for add_database_user
1 parent 4ed61ef commit a52f419

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
nose
22
mock
3+
httpretty

tests/influxdb/client_test.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import requests
77
import socket
88
import unittest
9+
import httpretty
910
from nose.tools import raises
1011
from mock import patch
1112

@@ -331,8 +332,29 @@ def test_delete_database_admin(self):
331332
def test_get_database_user(self):
332333
pass
333334

335+
@httpretty.activate
334336
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+
)
336358

337359
def test_add_database_user_bad_permissions(self):
338360
cli = InfluxDBClient()

0 commit comments

Comments
 (0)