Merge pull request #48747 from rallytime/merge-2018.3

[2018.3] Merge forward from 2017.7 to 2018.3
This commit is contained in:
Nicole Thomas 2018-07-26 14:14:33 -04:00 committed by GitHub
commit 6978ce5d1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 2 deletions

View file

@ -668,8 +668,8 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
This is a regression test for Issue #38914 and Issue #48230 (test=true use).
'''
name = os.path.join(TMP, 'source_hash_indifferent_case')
state_name = 'file_|-/tmp/salt-tests-tmpdir/source_hash_indifferent_case_|' \
'-/tmp/salt-tests-tmpdir/source_hash_indifferent_case_|-managed'
state_name = 'file_|-{0}_|' \
'-{0}_|-managed'.format(name)
local_path = os.path.join(FILES, 'file', 'base', 'hello_world.txt')
actual_hash = 'c98c24b677eff44860afea6f493bbaec5bb1c4cbb209c6fc2bbb47f66ff2ad31'
uppercase_hash = actual_hash.upper()

View file

@ -42,9 +42,19 @@ class ServiceTest(ModuleCase, SaltReturnAssertsMixin):
self.stopped = ''
self.running = '[0-9]'
self.pre_srv_enabled = True if self.service_name in self.run_function('service.get_enabled') else False
self.post_srv_disable = False
if not self.pre_srv_enabled:
self.run_function('service.enable', name=self.service_name)
self.post_srv_disable = True
if salt.utils.path.which(cmd_name) is None:
self.skipTest('{0} is not installed'.format(cmd_name))
def tearDown(self):
if self.post_srv_disable:
self.run_function('service.disable', name=self.service_name)
def check_service_status(self, exp_return):
'''
helper method to check status of service

View file

@ -241,6 +241,18 @@ class WinServiceTestCase(TestCase, LoaderModuleMockMixin):
self.assertTrue(win_service.enabled('spongebob'))
self.assertFalse(win_service.enabled('squarepants'))
def test_enabled_with_space_in_name(self):
'''
Test to check to see if the named
service is enabled to start on boot
when have space in service name
'''
mock = MagicMock(side_effect=[{'StartType': 'Auto'},
{'StartType': 'Disabled'}])
with patch.object(win_service, 'info', mock):
self.assertTrue(win_service.enabled('spongebob test'))
self.assertFalse(win_service.enabled('squarepants test'))
def test_disabled(self):
'''
Test to check to see if the named