Skip to content

Commit fb608a5

Browse files
authored
Update test_mine.py
1 parent acbef02 commit fb608a5

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

tests/pytests/integration/runners/test_mine.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44

55
import pytest
66

7-
import salt.config
8-
import salt.runners.mine as mine_runner
9-
from tests.support.mock import patch
107

8+
@pytest.fixture(scope="session")
9+
def salt_minion_id():
10+
return "test-mine"
1111

12-
@pytest.fixture(scope="module")
13-
def mine(runners):
14-
return runners.mine
15-
16-
17-
@pytest.fixture(scope="module")
18-
def minion_opts():
19-
return salt.config.minion_config(None)
12+
@pytest.fixture(scope="session")
13+
def master_id():
14+
master_id = "test-mine"
15+
yield master_id
2016

2117

2218
@pytest.fixture(scope="module")
@@ -30,6 +26,8 @@ def pillar_tree(salt_master, salt_call_cli, salt_run_cli, salt_minion):
3026
mine_file = """
3127
mine_functions:
3228
test_fun:
29+
allow_tgt: '*'
30+
allow_tgt_type: 'glob'
3331
mine_function: cmd.run
3432
cmd: 'echo hello test'
3533
test_no_allow:
@@ -57,12 +55,10 @@ def pillar_tree(salt_master, salt_call_cli, salt_run_cli, salt_minion):
5755
assert ret.returncode == 0
5856

5957

60-
@pytest.mark.usefixtures("pillar_tree")
61-
def test_allow_tgt(salt_run_cli, salt_minion, minion_opts):
58+
@pytest.mark.usefixtures("pillar_tree", "master_id", "salt_minion_id")
59+
def test_allow_tgt(salt_run_cli, salt_minion):
6260
tgt = salt_minion.id
6361
fun = "test_fun"
64-
with patch("salt.runners.mine.__opts__", minion_opts, create=True):
65-
ret = mine_runner.get(tgt, fun)
6662

6763
ret = salt_run_cli.run("mine.get", tgt, fun)
6864
assert ret.data == {salt_minion.id: "hello test"}

0 commit comments

Comments
 (0)