mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Mock LocalClient in batch unit tests
This commit is contained in:
parent
c61a1eeb20
commit
2523d8c641
@ -5,6 +5,7 @@
|
||||
|
||||
# Import Salt Libs
|
||||
from salt.cli.batch import Batch
|
||||
from salt.client import LocalClient
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from salttesting import TestCase
|
||||
@ -20,9 +21,11 @@ class BatchTestCase(TestCase):
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
opts = {'batch': '', 'conf_file': '', 'tgt': ''}
|
||||
with patch('salt.client.LocalClient.cmd_iter', MagicMock(return_value=[])):
|
||||
self.batch = Batch(opts, quiet='quiet')
|
||||
opts = {'batch': '', 'conf_file': {}, 'tgt': ''}
|
||||
mock_client = MagicMock()
|
||||
with patch('salt.client.get_local_client', MagicMock(return_value=mock_client)):
|
||||
with patch('salt.client.LocalClient.cmd_iter', MagicMock(return_value=[])):
|
||||
self.batch = Batch(opts, quiet='quiet')
|
||||
|
||||
# get_bnum tests
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user