Skip to content

Commit aebe90a

Browse files
author
aviau
committed
Improved test_write_points
1 parent d0b87e3 commit aebe90a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/influxdb/client_test.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,21 @@ def test_switch_user(self):
9393
assert cli._password == 'another_password'
9494

9595
def test_write_points(self):
96-
with _mocked_session('post', 200, self.dummy_points):
97-
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
98-
assert cli.write_points(self.dummy_points) is True
96+
with requests_mock.Mocker() as m:
97+
m.register_uri(
98+
requests_mock.POST,
99+
"http://localhost:8086/db/db/series"
100+
)
101+
102+
cli = InfluxDBClient(database='db')
103+
cli.write_points(
104+
self.dummy_points
105+
)
106+
107+
self.assertListEqual(
108+
json.loads(m.last_request.body),
109+
self.dummy_points
110+
)
99111

100112
def test_write_points_batch(self):
101113
with _mocked_session('post', 200, self.dummy_points):

0 commit comments

Comments
 (0)