Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3942666
salt_test_case.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
968 B
Referenced Files
None
Subscribers
None
salt_test_case.py
View Options
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
.
salt
=
source
.
dunder
()
self
.
grains
=
source
.
dunder
()
@staticmethod
def
import_data_from_yaml
(
filename
):
with
open
(
filename
,
"r"
)
as
fd
:
return
yaml
.
safe_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
def
mock_salt
(
self
,
target
=
None
):
if
not
target
:
target
=
self
.
instance
target
.
__salt__
=
self
.
salt
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Thu, Dec 26, 19:56 (11 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2261034
Default Alt Text
salt_test_case.py (968 B)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment