

@mock.patch('bareon.utils.grub.os.path.isdir')
def test_guess_grub2_conf(self, mock_isdir):
    side_effect_values = {
        '/target/boot/grub': True,
        '/target/boot/grub2': False,
    }

    def side_effect(key):
        return side_effect_values[key]
    mock_isdir.side_effect = side_effect
    self.assertEqual(gu.guess_grub2_conf('/target'), '/boot/grub/grub.cfg')
    side_effect_values = {
        '/target/boot/grub': False,
        '/target/boot/grub2': True,
    }
    self.assertEqual(gu.guess_grub2_conf('/target'), '/boot/grub2/grub.cfg')

dataset/ETHPy150Open openstack/bareon/bareon/tests/test_grub_utils.py TestGrubUtils.test_guess_grub2_conf/original