@@ -103,33 +103,32 @@ def test_switch_user(self):
103
103
assert cli ._password == 'another_password'
104
104
105
105
def test_write (self ):
106
- with requests_mock .Mocker () as m :
107
- m .register_uri (
108
- requests_mock .POST ,
109
- "http://localhost:8086/write"
110
- )
111
-
112
- cli = InfluxDBClient (database = 'db' )
113
- cli .write (
114
- {"database" : "mydb" ,
115
- "retentionPolicy" : "mypolicy" ,
116
- "points" : [{"name" : "cpu_load_short" ,
117
- "tags" : {"host" : "server01" ,
118
- "region" : "us-west" },
119
- "timestamp" : "2009-11-10T23:00:00Z" ,
120
- "values" : {"value" : 0.64 }}]}
121
- )
122
-
123
- self .assertEqual (
124
- json .loads (m .last_request .body ),
125
- {"database" : "mydb" ,
126
- "retentionPolicy" : "mypolicy" ,
127
- "points" : [{"name" : "cpu_load_short" ,
128
- "tags" : {"host" : "server01" ,
129
- "region" : "us-west" },
130
- "timestamp" : "2009-11-10T23:00:00Z" ,
131
- "values" : {"value" : 0.64 }}]}
132
- )
106
+ with requests_mock .Mocker () as m :
107
+ m .register_uri (
108
+ requests_mock .POST ,
109
+ "http://localhost:8086/write"
110
+ )
111
+ cli = InfluxDBClient (database = 'db' )
112
+ cli .write (
113
+ {"database" : "mydb" ,
114
+ "retentionPolicy" : "mypolicy" ,
115
+ "points" : [{"name" : "cpu_load_short" ,
116
+ "tags" : {"host" : "server01" ,
117
+ "region" : "us-west" },
118
+ "timestamp" : "2009-11-10T23:00:00Z" ,
119
+ "values" : {"value" : 0.64 }}]}
120
+ )
121
+
122
+ self .assertEqual (
123
+ json .loads (m .last_request .body ),
124
+ {"database" : "mydb" ,
125
+ "retentionPolicy" : "mypolicy" ,
126
+ "points" : [{"name" : "cpu_load_short" ,
127
+ "tags" : {"host" : "server01" ,
128
+ "region" : "us-west" },
129
+ "timestamp" : "2009-11-10T23:00:00Z" ,
130
+ "values" : {"value" : 0.64 }}]}
131
+ )
133
132
134
133
def test_write_points (self ):
135
134
with requests_mock .Mocker () as m :
@@ -539,7 +538,7 @@ def test_get_database_users(self):
539
538
cli = InfluxDBClient ('localhost' , 8086 , 'username' , 'password' , 'db' )
540
539
541
540
example_response = \
542
- '[{"name":"paul","isAdmin":false,"writeTo":".*","readFrom":".*"},' \
541
+ '[{"name":"paul","isAdmin":false,"writeTo":".*","readFrom":".*"},' \
543
542
'{"name":"bobby","isAdmin":false,"writeTo":".*","readFrom":".*"}]'
544
543
545
544
with requests_mock .Mocker () as m :
0 commit comments