Page MenuHomeDevCentral

D2574.id.diff
No OneTemporary

D2574.id.diff

diff --git a/_tests/modules/test_rust.py b/_tests/modules/test_rust.py
--- a/_tests/modules/test_rust.py
+++ b/_tests/modules/test_rust.py
@@ -3,12 +3,20 @@
from importlib.machinery import SourceFileLoader
import unittest
+from salt.modules import cmdmod
salt_test_case = SourceFileLoader("salt_test_case", "salt_test_case.py").load_module()
rust = SourceFileLoader("rust", "../_modules/rust.py").load_module()
class Testinstance(unittest.TestCase, salt_test_case.SaltTestCase):
+ def setUp(self):
+ self.initialize_mocks()
+ self.instance = rust
+
+ self.mock_salt()
+ self.salt["cmd.shell"] = cmdmod.shell
+
def test_get_rustc_triplet(self):
triplet = rust.get_rustc_triplet()
diff --git a/_tests/salt_test_case.py b/_tests/salt_test_case.py
--- a/_tests/salt_test_case.py
+++ b/_tests/salt_test_case.py
@@ -6,6 +6,7 @@
def initialize_mocks(self):
source = SourceFileLoader("dunder", "mocks/dunder.py").load_module()
self.pillar = source.dunder()
+ self.salt = source.dunder()
self.grains = source.dunder()
@staticmethod
@@ -27,3 +28,9 @@
target = self.instance
target.__grains__ = self.grains
+
+ def mock_salt(self, target=None):
+ if not target:
+ target = self.instance
+
+ target.__salt__ = self.salt

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 07:47 (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2246209
Default Alt Text
D2574.id.diff (1 KB)

Event Timeline