Fix up import and docstring syntax

This commit is contained in:
Daniel A. Wozniak 2018-03-28 20:54:35 -07:00
parent 62d64c9230
commit 5aabd442f2
No known key found for this signature in database
GPG Key ID: 166B9D2C06C82D61

View File

@ -14,8 +14,8 @@ from tests.support.mock import (
# Import salt libs
import salt.states.environ as envstate
import salt.modules.environ as envmodule
import salt.modules.reg as regmodule
import salt.utils as utils
import salt.modules.reg
import salt.utils
class TestEnvironState(TestCase, LoaderModuleMockMixin):
@ -26,7 +26,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
'__opts__': {'test': False},
'__salt__': {
'environ.setenv': envmodule.setenv,
'reg.read_value': regmodule.read_value,
'reg.read_value': salt.modules.reg.read_value,
}
}
return {envstate: loader_globals, envmodule: loader_globals}
@ -53,7 +53,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
ret = envstate.setenv('test', 'other')
self.assertEqual(ret['changes'], {})
@skipIf(not utils.is_windows(), 'Windows only')
@skipIf(not salt.utils.is_windows(), 'Windows only')
def test_setenv_permanent(self):
'''test that we can set perminent environment variables (requires pywin32)'''
with patch.dict(envmodule.__salt__, {'reg.set_value': MagicMock(), 'reg.delete_value': MagicMock()}):
@ -89,7 +89,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
'''test that ``clear_all`` option sets other values to '' '''
ret = envstate.setenv('test', 'value', clear_all=True)
self.assertEqual(ret['changes'], {'test': 'value', 'INITIAL': ''})
if utils.is_windows():
if salt.utils.is_windows():
self.assertEqual(envstate.os.environ, {'TEST': 'value', 'INITIAL': ''})
else:
self.assertEqual(envstate.os.environ, {'test': 'value', 'INITIAL': ''})
@ -99,7 +99,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
unsets other values from environment'''
ret = envstate.setenv('test', 'value', false_unsets=True, clear_all=True)
self.assertEqual(ret['changes'], {'test': 'value', 'INITIAL': None})
if utils.is_windows():
if salt.utils.is_windows():
self.assertEqual(envstate.os.environ, {'TEST': 'value'})
else:
self.assertEqual(envstate.os.environ, {'test': 'value'})
@ -113,7 +113,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
ret = envstate.setenv(
'notimportant', {'test': False, 'foo': 'baz'}, false_unsets=True)
self.assertEqual(ret['changes'], {'test': None, 'foo': 'baz'})
if utils.is_windows():
if salt.utils.is_windows():
self.assertEqual(envstate.os.environ, {'INITIAL': 'initial', 'FOO': 'baz'})
else:
self.assertEqual(envstate.os.environ, {'INITIAL': 'initial', 'foo': 'baz'})
@ -121,7 +121,7 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin):
with patch.dict(envstate.__salt__, {'reg.read_value': MagicMock()}):
ret = envstate.setenv('notimportant', {'test': False, 'foo': 'bax'})
self.assertEqual(ret['changes'], {'test': '', 'foo': 'bax'})
if utils.is_windows():
if salt.utils.is_windows():
self.assertEqual(envstate.os.environ, {'INITIAL': 'initial', 'FOO': 'bax', 'TEST': ''})
else:
self.assertEqual(envstate.os.environ, {'INITIAL': 'initial', 'foo': 'bax', 'test': ''})