Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 0e00f32

Browse files
committed
test bind_params in query
1 parent 9c30d90 commit 0e00f32

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

influxdb/tests/dataframe_client_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ def test_query_into_dataframe(self):
837837
assert_frame_equal(expected[k], result[k])
838838

839839
def test_multiquery_into_dataframe(self):
840-
"""Test multiquyer into df for TestDataFrameClient object."""
840+
"""Test multiquery into df for TestDataFrameClient object."""
841841
data = {
842842
"results": [
843843
{
@@ -879,10 +879,11 @@ def test_multiquery_into_dataframe(self):
879879
expected = [{'cpu_load_short': pd1}, {'cpu_load_short': pd2}]
880880

881881
cli = DataFrameClient('host', 8086, 'username', 'password', 'db')
882-
iql = "SELECT value FROM cpu_load_short WHERE region='us-west';"\
883-
"SELECT count(value) FROM cpu_load_short WHERE region='us-west'"
882+
iql = "SELECT value FROM cpu_load_short WHERE region=$region;"\
883+
"SELECT count(value) FROM cpu_load_short WHERE region=$region"
884+
bind_params = {'region': 'us-west'}
884885
with _mocked_session(cli, 'GET', 200, data):
885-
result = cli.query(iql)
886+
result = cli.query(iql, bind_params=bind_params)
886887
for r, e in zip(result, expected):
887888
for k in e:
888889
assert_frame_equal(e[k], r[k])

influxdb/tests/server_tests/client_test_with_server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ def test_write_points_batch(self):
440440
batch_size=2)
441441
time.sleep(5)
442442
net_in = self.cli.query("SELECT value FROM network "
443-
"WHERE direction='in'").raw
443+
"WHERE direction=$dir",
444+
bind_params={'dir': 'in'}
445+
).raw
444446
net_out = self.cli.query("SELECT value FROM network "
445447
"WHERE direction='out'").raw
446448
cpu = self.cli.query("SELECT value FROM cpu_usage").raw

0 commit comments

Comments
 (0)