mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fix lint and tests
This commit is contained in:
parent
4775e6bdf0
commit
6c7b21676a
@ -186,7 +186,7 @@ def install(feature, recurse=False, source=None, restart=False):
|
||||
|
||||
|
||||
def remove(feature, remove_payload=False, restart=False):
|
||||
'''
|
||||
r'''
|
||||
Remove an installed feature
|
||||
|
||||
.. note::
|
||||
|
@ -18,6 +18,7 @@ from salt.modules import win_servermanager
|
||||
|
||||
# Globals
|
||||
win_servermanager.__salt__ = {}
|
||||
win_servermanager.__grains__ = {}
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
@ -56,13 +57,16 @@ class WinServermanagerTestCase(TestCase):
|
||||
'FeatureResult':
|
||||
[{'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False}]})
|
||||
with patch.object(win_servermanager, '_pshell_json', mock):
|
||||
expected = {'ExitCode': 0,
|
||||
'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False,
|
||||
'Success': True}
|
||||
self.assertDictEqual(
|
||||
win_servermanager.install('Telnet-Client'), expected)
|
||||
grain_mock = MagicMock(return_value='10.0.15130')
|
||||
with patch.dict(
|
||||
win_servermanager.__grains__, {'osversion': grain_mock}):
|
||||
with patch.object(win_servermanager, '_pshell_json', mock):
|
||||
expected = {'ExitCode': 0,
|
||||
'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False,
|
||||
'Success': True}
|
||||
self.assertDictEqual(
|
||||
win_servermanager.install('Telnet-Client'), expected)
|
||||
|
||||
def test_remove(self):
|
||||
'''
|
||||
@ -73,13 +77,16 @@ class WinServermanagerTestCase(TestCase):
|
||||
'FeatureResult':
|
||||
[{'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False}]})
|
||||
with patch.object(win_servermanager, '_pshell_json', mock):
|
||||
expected = {'ExitCode': 0,
|
||||
'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False,
|
||||
'Success': True}
|
||||
self.assertDictEqual(
|
||||
win_servermanager.remove('Telnet-Client'), expected)
|
||||
grain_mock = MagicMock(return_value='10.0.15130')
|
||||
with patch.dict(
|
||||
win_servermanager.__grains__, {'osversion': grain_mock}):
|
||||
with patch.object(win_servermanager, '_pshell_json', mock):
|
||||
expected = {'ExitCode': 0,
|
||||
'DisplayName': 'Spongebob',
|
||||
'RestartNeeded': False,
|
||||
'Success': True}
|
||||
self.assertDictEqual(
|
||||
win_servermanager.remove('Telnet-Client'), expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user