@@ -139,7 +139,7 @@ def test_write(self):
139
139
with requests_mock .Mocker () as m :
140
140
m .register_uri (
141
141
requests_mock .POST ,
142
- "http://localhost:8086/write " ,
142
+ "http://localhost:8086/write_points " ,
143
143
status_code = 204
144
144
)
145
145
cli = InfluxDBClient (database = 'db' )
@@ -154,21 +154,15 @@ def test_write(self):
154
154
)
155
155
156
156
self .assertEqual (
157
- json .loads (m .last_request .body ),
158
- {"database" : "mydb" ,
159
- "retentionPolicy" : "mypolicy" ,
160
- "points" : [{"measurement" : "cpu_load_short" ,
161
- "tags" : {"host" : "server01" ,
162
- "region" : "us-west" },
163
- "timestamp" : "2009-11-10T23:00:00Z" ,
164
- "fields" : {"value" : 0.64 }}]}
157
+ m .last_request .body ,
158
+ b"cpu_load_short,host=server01,region=us-west value=0.64 1257890400000000000\n " ,
165
159
)
166
160
167
161
def test_write_points (self ):
168
162
with requests_mock .Mocker () as m :
169
163
m .register_uri (
170
164
requests_mock .POST ,
171
- "http://localhost:8086/write " ,
165
+ "http://localhost:8086/write_points " ,
172
166
status_code = 204
173
167
)
174
168
@@ -188,7 +182,7 @@ def test_write_points_toplevel_attributes(self):
188
182
with requests_mock .Mocker () as m :
189
183
m .register_uri (
190
184
requests_mock .POST ,
191
- "http://localhost:8086/write " ,
185
+ "http://localhost:8086/write_points " ,
192
186
status_code = 204
193
187
)
194
188
@@ -227,7 +221,7 @@ def test_write_points_batch(self):
227
221
"fields" : {"value" : 12.00 }}]}
228
222
with requests_mock .Mocker () as m :
229
223
m .register_uri (requests_mock .POST ,
230
- "http://localhost:8086/write " ,
224
+ "http://localhost:8086/write_points " ,
231
225
status_code = 204 )
232
226
cli = InfluxDBClient (database = 'db' )
233
227
cli .write_points (points = dummy_points ,
@@ -284,7 +278,7 @@ def test_write_points_with_precision(self):
284
278
with requests_mock .Mocker () as m :
285
279
m .register_uri (
286
280
requests_mock .POST ,
287
- "http://localhost:8086/write " ,
281
+ "http://localhost:8086/write_points " ,
288
282
status_code = 204
289
283
)
290
284
@@ -294,12 +288,9 @@ def test_write_points_with_precision(self):
294
288
time_precision = 'n'
295
289
)
296
290
297
- self .assertDictEqual (
298
- {'points' : self .dummy_points ,
299
- 'database' : 'db' ,
300
- 'precision' : 'n' ,
301
- },
302
- json .loads (m .last_request .body )
291
+ self .assertEqual (
292
+ b"cpu_load_short,host=server01,region=us-west value=0.64 1257890400000000000\n " ,
293
+ m .last_request .body ,
303
294
)
304
295
305
296
def test_write_points_bad_precision (self ):
0 commit comments