mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add tests for influxdb create_continuous_query
Currently marked as xfail, since we'll pull the existing changes into here.
This commit is contained in:
parent
1e54e400d4
commit
479f1792aa
1 changed files with 52 additions and 0 deletions
52
tests/pytests/unit/states/test_influxdb_continuous_query.py
Normal file
52
tests/pytests/unit/states/test_influxdb_continuous_query.py
Normal file
|
@ -0,0 +1,52 @@
|
|||
import pytest
|
||||
|
||||
import salt.modules.influxdbmod as influx_mod
|
||||
import salt.states.influxdb_continuous_query as influx
|
||||
from tests.support.mock import create_autospec, patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def configure_loader_modules():
|
||||
return {influx: {"__salt__": {}, "__opts__": {"test": False}}}
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
@pytest.mark.parametrize(
|
||||
"expected_kwargs",
|
||||
(
|
||||
{},
|
||||
{"something": "extra"},
|
||||
{"something": "extra", "even": "more"},
|
||||
{"something": "extra", "still": "more and more and more", "and": "more"},
|
||||
{
|
||||
"something": "extra",
|
||||
"what": "in tarnation",
|
||||
"do": "you want",
|
||||
"to": "add here?",
|
||||
},
|
||||
),
|
||||
)
|
||||
def test_when_present_is_called_it_should_pass_client_args_to_create_module(
|
||||
expected_kwargs,
|
||||
):
|
||||
influx_module = create_autospec(influx_mod)
|
||||
influx_module.continuous_query_exists.return_value = False
|
||||
with patch.dict(
|
||||
influx.__salt__,
|
||||
{
|
||||
"influxdb.continuous_query_exists": influx_module.continuous_query_exists,
|
||||
"influxdb.create_continuous_query": influx_module.create_continuous_query,
|
||||
},
|
||||
):
|
||||
influx.present(
|
||||
name="foo",
|
||||
database="fnord",
|
||||
query="fnord",
|
||||
resample_time="whatever",
|
||||
coverage_period="fnord",
|
||||
**expected_kwargs
|
||||
)
|
||||
|
||||
actual_kwargs = influx_module.create_continuous_query.mock_calls[0].kwargs
|
||||
|
||||
assert actual_kwargs == expected_kwargs
|
Loading…
Add table
Reference in a new issue