mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
tests: fix a leftover and simplify some parts
This commit is contained in:
parent
13e5997457
commit
e5cc667762
1 changed files with 24 additions and 30 deletions
|
@ -59,38 +59,33 @@ class GenesisTestCase(TestCase):
|
|||
param_sets = [
|
||||
|
||||
{'params': {},
|
||||
'commandlines': [
|
||||
['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/'],
|
||||
]},
|
||||
'cmd': ['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/']
|
||||
},
|
||||
|
||||
{'params': {'pkgs': 'vim'},
|
||||
'commandlines': [
|
||||
['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/'],
|
||||
]},
|
||||
'cmd': ['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/']
|
||||
},
|
||||
|
||||
{'params': {'pkgs': 'vim,emacs'},
|
||||
'commandlines': [
|
||||
['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/'],
|
||||
]},
|
||||
'cmd': ['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/']
|
||||
},
|
||||
|
||||
{'params': {'pkgs': ['vim', 'emacs']},
|
||||
'commandlines': [
|
||||
['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/'],
|
||||
]},
|
||||
'cmd': ['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/']
|
||||
},
|
||||
|
||||
{'params': {'pkgs': ['vim', 'emacs'], 'exclude_pkgs': ['vim', 'foo']},
|
||||
'commandlines': [
|
||||
['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs', '--exclude', 'vim,foo',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/'],
|
||||
]},
|
||||
'cmd': ['debootstrap', '--foreign', '--arch', 'amd64',
|
||||
'--include', 'vim,emacs', '--exclude', 'vim,foo',
|
||||
'stable', 'root', 'http://ftp.debian.org/debian/']
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
|
@ -99,13 +94,12 @@ class GenesisTestCase(TestCase):
|
|||
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(),
|
||||
'file.rmdir': MagicMock(),
|
||||
'file.directory_exists': MagicMock(),
|
||||
'cmd.run': MagicMock()}):
|
||||
with patch.dict(genesis.__salt__, {'disk.blkid': MagicMock(return_value={})}):
|
||||
'cmd.run': MagicMock(),
|
||||
'disk.blkid': MagicMock(return_value={})}):
|
||||
with patch('salt.modules.genesis.salt.utils.which', return_value=True):
|
||||
param_set['params'].update(common_parms)
|
||||
self.assertEqual(genesis.bootstrap(**param_set['params']),
|
||||
None)
|
||||
for commandline in param_set['commandlines']:
|
||||
genesis.__salt__['cmd.run'].assert_any_call(commandline, python_shell=False)
|
||||
self.assertEqual(genesis.bootstrap(**param_set['params']), None)
|
||||
genesis.__salt__['cmd.run'].assert_any_call(param_set['cmd'], python_shell=False)
|
||||
|
||||
with patch.object(genesis, '_bootstrap_pacman', return_value='A') as pacman_patch:
|
||||
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(),
|
||||
|
|
Loading…
Add table
Reference in a new issue