

@mock.patch('bareon.utils.grub.guess_kernel')
@mock.patch('bareon.utils.grub.guess_initrd')
def test_grub1_cfg_kernel_initrd_are_not_set(self, mock_initrd, mock_kernel):
    mock_open_file.return_value = 'kernel-version'
    mock_initrd.return_value = 'initrd-version'
    config = '\ndefault=0\ntimeout=5\ntitle Default (kernel-version)\n    kernel /kernel-version kernel-params\n    initrd /initrd-version\n    '
    mock_open = mock.mock_open()
    with mock.patch('bareon.utils.grub.open', new=mock_open, create=True):
        gu.grub1_cfg(chroot='/target', kernel_params='kernel-params')
    mock_open.assert_called_once_with('/target/boot/grub/grub.conf', 'wt', encoding='utf-8')
    mock_open_file = mock_open()
    mock_open_file.write.assert_called_once_with(config)

dataset/ETHPy150Open openstack/bareon/bareon/tests/test_grub_utils.py TestGrubUtils.test_grub1_cfg_kernel_initrd_are_not_set/VarMisuse@30/70 `mock_kernel`->`mock_open_file`