Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3742520
D2574.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2574.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D2574: Allow to resolve __salt__ in rust module tests
Attached
Detach File
Event Timeline
Log In to Comment