Fix InfluxDB v2 API with write precision None (#41937)
This commit is contained in:
1 parent
1e256e6122
commit
92f89213a3
2 files changed
+16
-4
No files matched your search
@@ -61,10 +61,17 @@ def mock_client_fixture(request):
|
||||
@pytest.fixture(name="get_mock_call")
|
||||
def get_mock_call_fixture(request):
|
||||
"""Get version specific lambda to make write API call mock."""
|
||||
|
||||
def v2_call(body, precision):
|
||||
data = {"bucket": DEFAULT_BUCKET, "record": body}
|
||||
|
||||
if precision is not None:
|
||||
data["write_precision"] = precision
|
||||
|
||||
return call(**data)
|
||||
|
||||
if request.param == influxdb.API_VERSION_2:
|
||||
return lambda body, precision=None: call(
|
||||
bucket=DEFAULT_BUCKET, record=body, write_precision=precision
|
||||
)
|
||||
return lambda body, precision=None: v2_call(body, precision)
|
||||
# pylint: disable=unnecessary-lambda
|
||||
return lambda body, precision=None: call(body, time_precision=precision)
|
||||
|
||||
|
||||
Reference in new issue
Block a user