mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix tests (#35693)
* Fix tests/unit/modules/useradd_test.py::UserAddTestCase::test_info * Fix unit/pyobjects_test.py::MapTests::test_map * Fix tests/unit/pyobjects_test.py::RendererTests::test_extend * Fix tests/unit/pyobjects_test.py::RendererTests::test_requisite_implicit_list
This commit is contained in:
parent
29814f9d43
commit
8b480167e1
2 changed files with 13 additions and 4 deletions
|
@ -326,7 +326,7 @@ class UserAddTestCase(TestCase):
|
|||
'''
|
||||
Test the user information
|
||||
'''
|
||||
self.assertEqual(useradd.info('salt'), {})
|
||||
self.assertEqual(useradd.info('username-that-doesnt-exist'), {})
|
||||
|
||||
mock = MagicMock(return_value=pwd.struct_passwd(('_TEST_GROUP',
|
||||
'*',
|
||||
|
@ -336,9 +336,7 @@ class UserAddTestCase(TestCase):
|
|||
'/var/virusmails',
|
||||
'/usr/bin/false')))
|
||||
with patch.object(pwd, 'getpwnam', mock):
|
||||
mock = MagicMock(return_value='Group Name')
|
||||
with patch.object(useradd, 'list_groups', mock):
|
||||
self.assertEqual(useradd.info('salt')['name'], '_TEST_GROUP')
|
||||
self.assertEqual(useradd.info('username-that-doesnt-exist')['name'], '_TEST_GROUP')
|
||||
|
||||
# 'list_groups' function tests: 1
|
||||
|
||||
|
|
|
@ -54,10 +54,18 @@ include('http')
|
|||
|
||||
extend_template = '''#!pyobjects
|
||||
include('http')
|
||||
|
||||
from salt.utils.pyobjects import StateFactory
|
||||
Service = StateFactory('service')
|
||||
|
||||
Service.running(extend('apache'), watch=[{'file': '/etc/file'}])
|
||||
'''
|
||||
|
||||
map_template = '''#!pyobjects
|
||||
from salt.utils.pyobjects import StateFactory
|
||||
Service = StateFactory('service')
|
||||
|
||||
|
||||
class Samba(Map):
|
||||
__merge__ = 'samba:lookup'
|
||||
|
||||
|
@ -127,6 +135,9 @@ from salt://password.sls import password
|
|||
'''
|
||||
|
||||
requisite_implicit_list_template = '''#!pyobjects
|
||||
from salt.utils.pyobjects import StateFactory
|
||||
Service = StateFactory('service')
|
||||
|
||||
with Pkg.installed("pkg"):
|
||||
Service.running("service", watch=File("file"), require=Cmd("cmd"))
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue