mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Convert test_custom grains test to pytest
Converts the test_custom grains test from an old style test to a pytest test. This is just to make it easier for me to debug why it is failing and needs to be done at some point anyway.
This commit is contained in:
parent
2ca8551615
commit
9a327c5919
3 changed files with 21 additions and 24 deletions
|
@ -155,7 +155,7 @@ salt/engines/*:
|
|||
- pytests.unit.engines.test_engines
|
||||
|
||||
salt/grains/*:
|
||||
- integration.grains.test_custom
|
||||
- pytests.integration.grains.test_custom
|
||||
|
||||
salt/matchers/*:
|
||||
- integration.states.test_match
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
"""
|
||||
Test the core grains
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
||||
@pytest.mark.windows_whitelisted
|
||||
class TestGrainsCore(ModuleCase):
|
||||
"""
|
||||
Test the core grains grains
|
||||
"""
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_grains_passed_to_custom_grain(self):
|
||||
"""
|
||||
test if current grains are passed to grains module functions that have a grains argument
|
||||
"""
|
||||
self.assertEqual(
|
||||
self.run_function("grains.get", ["custom_grain_test"]), "itworked"
|
||||
)
|
20
tests/pytests/integration/grains/test_custom.py
Normal file
20
tests/pytests/integration/grains/test_custom.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""
|
||||
Test the custom grains
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.windows_whitelisted,
|
||||
pytest.mark.slow_test,
|
||||
]
|
||||
|
||||
|
||||
def test_grains_passed_to_custom_grain(salt_call_cli):
|
||||
"""
|
||||
test if current grains are passed to grains module functions that have a grains argument
|
||||
"""
|
||||
ret = salt_call_cli.run("grains.item", "custom_grain_test")
|
||||
assert ret.returncode == 0
|
||||
assert ret.data
|
||||
assert ret.data["custom_grain_test"] == "itworked"
|
Loading…
Add table
Reference in a new issue