modules.genesis: update unit tests for bootstrap

This commit is contained in:
Justin Findlay 2015-12-07 15:19:22 -07:00
parent 5d69de04db
commit 99b229c9fe

View File

@ -44,22 +44,25 @@ class GenesisTestCase(TestCase):
with patch.object(genesis, '_bootstrap_yum', return_value='A'):
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(),
'file.rmdir': MagicMock()}):
'file.rmdir': MagicMock(),
'file.directory_exists': MagicMock()}):
with patch.dict(genesis.__salt__, {'disk.blkid': MagicMock(return_value={})}):
self.assertEqual(genesis.bootstrap('rpm', 'root', 'dir1'), None)
self.assertEqual(genesis.bootstrap('rpm', 'root', 'dir'), None)
with patch.object(genesis, '_bootstrap_deb', return_value='A'):
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(),
'file.rmdir': MagicMock()}):
'file.rmdir': MagicMock(),
'file.directory_exists': MagicMock()}):
with patch.dict(genesis.__salt__, {'disk.blkid': MagicMock(return_value={})}):
self.assertEqual(genesis.bootstrap('deb', 'root', 'dir1'), None)
self.assertEqual(genesis.bootstrap('deb', 'root', 'dir'), None)
with patch.object(genesis, '_bootstrap_pacman', return_value='A') as pacman_patch:
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(return_value=True)}):
with patch.dict(genesis.__salt__, {'file.rmdir': MagicMock(return_value=True)}):
with patch.dict(genesis.__salt__, {'disk.blkid': MagicMock(return_value={})}):
genesis.bootstrap('pacman', 'root', 'dir1')
pacman_patch.assert_called_with('root', img_format='dir1', exclude_pkgs=[], pkgs=[])
with patch.dict(genesis.__salt__, {'mount.umount': MagicMock(),
'file.rmdir': MagicMock(),
'file.directory_exists': MagicMock(),
'disk.blkid': MagicMock(return_value={})}):
genesis.bootstrap('pacman', 'root', 'dir')
pacman_patch.assert_called_with('root', img_format='dir', exclude_pkgs=[], pkgs=[])
@patch('salt.utils.which', MagicMock(return_value=False))
def test_avail_platforms(self):