@@ -119,38 +119,40 @@ def test_write_points_from_dataframe_with_time_precision(self):
119119 "http://localhost:8086/write" ,
120120 status_code = 204 )
121121
122- points = {
123- 'database' : 'db' ,
124- 'points' : [
125- {'time' : '1970-01-01T00:00:00+00:00' ,
126- 'fields' : {
127- 'column_one' : '1' ,
128- 'column_three' : 1.0 ,
129- 'column_two' : 1 },
130- 'tags' : {},
131- 'measurement' : 'foo' },
132- {'time' : '1970-01-01T01:00:00+00:00' ,
133- 'fields' : {
134- 'column_one' : '2' ,
135- 'column_three' : 2.0 ,
136- 'column_two' : 2 },
137- 'tags' : {},
138- 'measurement' : 'foo' }]
139- }
140-
141122 cli = DataFrameClient (database = 'db' )
142123 measurement = "foo"
143124
144125 cli .write_points (dataframe , measurement , time_precision = 's' )
145126 self .assertEqual (m .last_request .qs ['precision' ], ['s' ])
127+ self .assertEqual (
128+ b'foo column_one="1",column_three=1.0,column_two=1 0\n foo '
129+ b'column_one="2",column_three=2.0,column_two=2 3600\n ' ,
130+ m .last_request .body ,
131+ )
146132
147- cli .write_points (dataframe , measurement , time_precision = 'm' )
148- points .update (precision = 'm' )
149- self .assertEqual (m .last_request .qs ['precision' ], ['m' ])
133+ cli .write_points (dataframe , measurement , time_precision = 'ms' )
134+ self .assertEqual (m .last_request .qs ['precision' ], ['ms' ])
135+ self .assertEqual (
136+ b'foo column_one="1",column_three=1.0,column_two=1 0\n foo '
137+ b'column_one="2",column_three=2.0,column_two=2 3600000\n ' ,
138+ m .last_request .body ,
139+ )
150140
151141 cli .write_points (dataframe , measurement , time_precision = 'u' )
152- points .update (precision = 'u' )
153142 self .assertEqual (m .last_request .qs ['precision' ], ['u' ])
143+ self .assertEqual (
144+ b'foo column_one="1",column_three=1.0,column_two=1 0\n foo '
145+ b'column_one="2",column_three=2.0,column_two=2 3600000000\n ' ,
146+ m .last_request .body ,
147+ )
148+
149+ cli .write_points (dataframe , measurement , time_precision = 'n' )
150+ self .assertEqual (m .last_request .qs ['precision' ], ['n' ])
151+ self .assertEqual (
152+ b'foo column_one="1",column_three=1.0,column_two=1 0\n foo '
153+ b'column_one="2",column_three=2.0,column_two=2 3600000000000\n ' ,
154+ m .last_request .body ,
155+ )
154156
155157 @raises (TypeError )
156158 def test_write_points_from_dataframe_fails_without_time_index (self ):
0 commit comments