Page MenuHomeDevCentral

salt_test_case.py
No OneTemporary

salt_test_case.py

from importlib.machinery import SourceFileLoader
import yaml
class SaltTestCase:
def initialize_mocks(self):
source = SourceFileLoader("dunder", "mocks/dunder.py").load_module()
self.pillar = source.dunder()
self.grains = source.dunder()
@staticmethod
def import_data_from_yaml(filename):
with open(filename, 'r') as fd:
return yaml.load(fd.read())
def mock_pillar(self, filename=None, target=None):
if not target:
target = self.instance
if filename:
self.pillar.data = self.import_data_from_yaml(filename)
target.__pillar__ = self.pillar
def mock_grains(self, target=None):
if not target:
target = self.instance
target.__grains__ = self.grains

File Metadata

Mime Type
text/x-python
Expires
Thu, Dec 26, 01:43 (5 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2266102
Default Alt Text
salt_test_case.py (794 B)

Event Timeline