mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update mocking to reflect changes in service module
This commit is contained in:
parent
b9ace5a859
commit
91cd57d1e0
1 changed files with 5 additions and 10 deletions
|
@ -32,8 +32,7 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to start the specified service
|
||||
'''
|
||||
with patch.object(os.path, 'join', return_value='A'):
|
||||
with patch.dict(service.__salt__, {'service.run':
|
||||
MagicMock(return_value=True)}):
|
||||
with patch.object(service, 'run', MagicMock(return_value=True)):
|
||||
self.assertTrue(service.start('name'))
|
||||
|
||||
def test_stop(self):
|
||||
|
@ -41,8 +40,7 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to stop the specified service
|
||||
'''
|
||||
with patch.object(os.path, 'join', return_value='A'):
|
||||
with patch.dict(service.__salt__, {'service.run':
|
||||
MagicMock(return_value=True)}):
|
||||
with patch.object(service, 'run', MagicMock(return_value=True)):
|
||||
self.assertTrue(service.stop('name'))
|
||||
|
||||
def test_restart(self):
|
||||
|
@ -50,8 +48,7 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to restart the specified service
|
||||
'''
|
||||
with patch.object(os.path, 'join', return_value='A'):
|
||||
with patch.dict(service.__salt__, {'service.run':
|
||||
MagicMock(return_value=True)}):
|
||||
with patch.object(service, 'run', MagicMock(return_value=True)):
|
||||
self.assertTrue(service.restart('name'))
|
||||
|
||||
def test_status(self):
|
||||
|
@ -69,8 +66,7 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to restart the specified service
|
||||
'''
|
||||
with patch.object(os.path, 'join', return_value='A'):
|
||||
with patch.dict(service.__salt__, {'service.run':
|
||||
MagicMock(return_value=True)}):
|
||||
with patch.object(service, 'run', MagicMock(return_value=True)):
|
||||
self.assertTrue(service.reload_('name'))
|
||||
|
||||
def test_run(self):
|
||||
|
@ -78,8 +74,7 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to run the specified service
|
||||
'''
|
||||
with patch.object(os.path, 'join', return_value='A'):
|
||||
with patch.dict(service.__salt__, {'cmd.retcode':
|
||||
MagicMock(return_value=False)}):
|
||||
with patch.object(service, 'run', MagicMock(return_value=True)):
|
||||
self.assertTrue(service.run('name', 'action'))
|
||||
|
||||
def test_available(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue