Skip test that requires pywin32 on *nix platforms

This commit is contained in:
Daniel A. Wozniak 2018-03-27 11:38:20 -07:00
parent 45dce1a485
commit 18b1730320
No known key found for this signature in database
GPG Key ID: 166B9D2C06C82D61

View File

@ -53,9 +53,10 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
ret = envstate.setenv('test', 'other')
self.assertEqual(ret['changes'], {})
@skipIf(not utils.is_windows(), 'Windows only')
def test_setenv_permanent(self):
with patch.dict(envmodule.__salt__, {'reg.set_value': MagicMock(), 'reg.delete_value': MagicMock()}), \
patch('salt.utils.is_windows', MagicMock(return_value=True)):
'''test that we can set perminent environment variables (requires pywin32)'''
with patch.dict(envmodule.__salt__, {'reg.set_value': MagicMock(), 'reg.delete_value': MagicMock()}):
ret = envstate.setenv('test', 'value', permanent=True)
self.assertEqual(ret['changes'], {'test': 'value'})
envmodule.__salt__['reg.set_value'].assert_called_with("HKCU", "Environment", 'test', 'value')