# Path: scripts/config.py
# def update_usb_mount(new_usb_details):
# def add_remounted(usb_disk):
# 
# Path: scripts/gen.py
# def scripts_dir_path():
# def print_version():
# def quote(text):
# def is_quoted(text):
# def has_digit(word):
# def sys_64bits():
# def iso_cfg_ext_dir():
# def clean_iso_cfg_ext_dir(iso_cfg_ext_dir):
# def copy_mbusb_dir_usb(usb_disk):
# def read_input_yes():
# def strings(filename, _min=4):
# def size_not_enough(iso_link, usb_disk):
# def mbusb_version():
# def check_text_in_file(file_path, text):
# def prepare_mbusb_host_dir():
# def grub_efi_exist(grub_efi_path):
# def process_exist(process_name):
# def write_to_file(filepath, text):
#     def __init__(self):
#     def windowsRam(self):
#     def linuxRam(self):
# class MemoryCheck():
#         class MEMORYSTATUS(ctypes.Structure):
# 
# Path: scripts/grub.py
# def mbusb_update_grub_cfg():
# def write_custom_grub_cfg(install_dir, loopback_cfg_path):
# def grub_custom_menu(mbus_grub_cfg_path, distro):
# def grub_raw_iso(mbus_grub_cfg_path):
# def write_to_file(file_path, _strings):
# def locate_kernel_file(subpath, isolinux_dir):
# def tweak_bootfile_path(img_file_spec, isolinux_dir):
# def extract_initrd_params_and_fix_kernel(value, isolinux_dir):
# def iso2grub2(install_dir, loopback_cfg_path):
# 
# Path: scripts/iso.py
# def iso_name(iso_link):
# def iso_basename(iso_link):
# def isolinux_bin_exist(iso_link):
# def iso_size(iso_link):
# def is_readable(iso_link):
# def is_bootable(iso_link):
# def isolinux_bin_dir(iso_link):
# def isolinux_bin_path(iso_link):
# def iso_menu_lst_path(iso_link):
# def integrity(iso_link):
# def iso_file_list(iso_link):
# def isolinux_version(isolinux_bin_path):
# def iso_extract_file(iso_link, dest_dir, _filter):
# def extract_cfg_file(iso_link):
# def iso_extract_full(iso_link, dest_dir):
# def iso_file_path(iso_link, file_name):
# def get_file_list(iso_link, predicate):


from functools import reduce
from unittest.mock import MagicMock, patch, sentinel
from scripts import config
from scripts import gen
from scripts import grub
from scripts import iso
import os
import sys
        return True
    if chunks[1] in ['rootfs1.gz', 'rootfs2.gz']:
        return True
    if chunks == ['multibootusb', 'debian-sid', 'boot', 'rootfs4.gz']:
        return True
    return False

def os_walk(dirpath):
    return [('isolinux', [], ['isolinux.cfg'])]

def test_iso2grub2():

    gen_log_mock = MagicMock()
    iso_bin_dir_mock = MagicMock()
    os_walk_mock = MagicMock()
    os_path_exists_mock = MagicMock()
    open_mock = MagicMock()
    @patch('scripts.gen.log', gen_log_mock)
    @patch('scripts.iso.isolinux_bin_dir', iso_bin_dir_mock)
    @patch('os.walk', os_walk)
    @patch('os.path.exists', os_path_exists)
    @patch('builtins.open', open_mock)
    def _():
        gen_log_mock.side_effect = gen_log
        open_mock.side_effect = my_open
        os_path_exists_mock.side_effect = os_path_exists
        os_walk_mock.side_effect = os_walk
        iso_bin_dir_mock.side_effect = iso_bin_dir

        config.image_path = '/home/suzuki/Downloads/debian-sid.iso'

# Path: scripts/config.py
# def update_usb_mount(new_usb_details):
# def add_remounted(usb_disk):
# 
# Path: scripts/gen.py
# def scripts_dir_path():
# def print_version():
# def quote(text):
# def is_quoted(text):
# def has_digit(word):
# def sys_64bits():
# def iso_cfg_ext_dir():
# def clean_iso_cfg_ext_dir(iso_cfg_ext_dir):
# def copy_mbusb_dir_usb(usb_disk):
# def read_input_yes():
# def strings(filename, _min=4):
# def size_not_enough(iso_link, usb_disk):
# def mbusb_version():
# def check_text_in_file(file_path, text):
# def prepare_mbusb_host_dir():
# def grub_efi_exist(grub_efi_path):
# def process_exist(process_name):
# def write_to_file(filepath, text):
#     def __init__(self):
#     def windowsRam(self):
#     def linuxRam(self):
# class MemoryCheck():
#         class MEMORYSTATUS(ctypes.Structure):
# 
# Path: scripts/grub.py
# def mbusb_update_grub_cfg():
# def write_custom_grub_cfg(install_dir, loopback_cfg_path):
# def grub_custom_menu(mbus_grub_cfg_path, distro):
# def grub_raw_iso(mbus_grub_cfg_path):
# def write_to_file(file_path, _strings):
# def locate_kernel_file(subpath, isolinux_dir):
# def tweak_bootfile_path(img_file_spec, isolinux_dir):
# def extract_initrd_params_and_fix_kernel(value, isolinux_dir):
# def iso2grub2(install_dir, loopback_cfg_path):
# 
# Path: scripts/iso.py
# def iso_name(iso_link):
# def iso_basename(iso_link):
# def isolinux_bin_exist(iso_link):
# def iso_size(iso_link):
# def is_readable(iso_link):
# def is_bootable(iso_link):
# def isolinux_bin_dir(iso_link):
# def isolinux_bin_path(iso_link):
# def iso_menu_lst_path(iso_link):
# def integrity(iso_link):
# def iso_file_list(iso_link):
# def isolinux_version(isolinux_bin_path):
# def iso_extract_file(iso_link, dest_dir, _filter):
# def extract_cfg_file(iso_link):
# def iso_extract_full(iso_link, dest_dir):
# def iso_file_path(iso_link, file_name):
# def get_file_list(iso_link, predicate):


# Path: tests/test-grub.py
from functools import reduce
from unittest.mock import MagicMock, patch, sentinel
from scripts import config
from scripts import gen
from scripts import grub
from scripts import iso
import os
import sys

        return True
    if chunks[1] in ['rootfs1.gz', 'rootfs2.gz']:
        return True
    if chunks == ['multibootusb', 'debian-sid', 'boot', 'rootfs4.gz']:
        return True
    return False

def os_walk(dirpath):
    return [('isolinux', [], ['isolinux.cfg'])]

def test_iso2grub2():

    gen_log_mock = MagicMock()
    iso_bin_dir_mock = MagicMock()
    os_walk_mock = MagicMock()
    os_path_exists_mock = MagicMock()
    open_mock = MagicMock()
    @patch('scripts.gen.log', gen_log_mock)
    @patch('scripts.iso.isolinux_bin_dir', iso_bin_dir_mock)
    @patch('os.walk', os_walk)
    @patch('os.path.exists', os_path_exists)
    @patch('builtins.open', open_mock)
    def _():
        gen_log_mock.side_effect = gen_log
        open_mock.side_effect = my_open
        os_path_exists_mock.side_effect = os_path_exists
        os_walk_mock.side_effect = os_walk
        iso_bin_dir_mock.side_effect = iso_bin_dir

        config.image_path = '/home/suzuki/Downloads/debian-sid.iso'

        grub.iso2grub2('/tmp/mbusb/debian', 'loopback.cfg')