Update mocking to reflect changes in service module

This commit is contained in:
Erik Johnson 2018-05-30 12:53:48 -05:00
parent b9ace5a859
commit 91cd57d1e0
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -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):