mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Migrate tests/integration/ssh/test_jinja_filters.py
to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b767b52b16
commit
8c56caec7b
4 changed files with 29 additions and 29 deletions
|
@ -196,9 +196,9 @@ salt/(client/ssh/.+|cli/ssh\.py):
|
|||
- integration.cli.test_custom_module
|
||||
- pytests.integration.ssh.test_deploy
|
||||
- pytests.integration.ssh.test_grains
|
||||
- integration.ssh.test_jinja_filters
|
||||
- pytests.integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_master
|
||||
- pytests.integration.ssh.test_jinja_filters
|
||||
- pytests.integration.ssh.test_pillar
|
||||
- pytests.integration.ssh.test_raw
|
||||
- integration.ssh.test_state
|
||||
|
@ -303,8 +303,8 @@ salt/utils/schedule.py:
|
|||
salt/utils/vt.py:
|
||||
- integration.cli.test_custom_module
|
||||
- pytests.integration.ssh.test_grains
|
||||
- integration.ssh.test_jinja_filters
|
||||
- pytests.integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_jinja_filters
|
||||
- pytests.integration.ssh.test_pillar
|
||||
- pytests.integration.ssh.test_raw
|
||||
- integration.ssh.test_state
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
import platform
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import SSHCase
|
||||
|
||||
|
||||
class SSHJinjaFiltersTest(SSHCase):
|
||||
"""
|
||||
testing Jinja filters are available via state system & salt-ssh
|
||||
"""
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_dateutils_strftime(self):
|
||||
"""
|
||||
test jinja filter datautils.strftime
|
||||
"""
|
||||
if "debian-9" in platform.platform().lower():
|
||||
pytest.skip("This test is broken on debian 9, skipping")
|
||||
arg = self._arg_str("state.sls", ["jinja_filters.dateutils_strftime"])
|
||||
ret = self.run_ssh(arg)
|
||||
import salt.utils.json
|
||||
|
||||
ret = salt.utils.json.loads(ret)["localhost"]
|
||||
self.assertIn("module_|-test_|-test.echo_|-run", ret)
|
||||
self.assertIn("ret", ret["module_|-test_|-test.echo_|-run"]["changes"])
|
27
tests/pytests/integration/ssh/test_jinja_filters.py
Normal file
27
tests/pytests/integration/ssh/test_jinja_filters.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import pytest
|
||||
from saltfactories.utils.functional import StateResult
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.slow_test,
|
||||
pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"),
|
||||
]
|
||||
|
||||
|
||||
def test_dateutils_strftime(salt_master, salt_ssh_cli):
|
||||
"""
|
||||
test jinja filter datautils.strftime
|
||||
"""
|
||||
sls_contents = """
|
||||
{% set result = none | strftime('%Y-%m-%d') %}
|
||||
test:
|
||||
module.run:
|
||||
- name: test.echo
|
||||
- text: {{ result }}
|
||||
"""
|
||||
with salt_master.state_tree.base.temp_file("dateutils.sls", sls_contents):
|
||||
ret = salt_ssh_cli.run("state.sls", "dateutils")
|
||||
assert ret.returncode == 0
|
||||
staterun = StateResult(ret.data)
|
||||
assert staterun.result is True
|
||||
assert staterun.changes
|
||||
assert "ret" in staterun.changes
|
|
@ -166,7 +166,6 @@ class BadTestModuleNamesTestCase(TestCase):
|
|||
"integration.spm.test_repo",
|
||||
"integration.ssh.test_deploy",
|
||||
"integration.ssh.test_grains",
|
||||
"integration.ssh.test_jinja_filters",
|
||||
"integration.ssh.test_master",
|
||||
"integration.ssh.test_mine",
|
||||
"integration.ssh.test_pillar",
|
||||
|
|
Loading…
Add table
Reference in a new issue