def nonbtrfs_run_test(self, devdata_mock, storage_mock, symlink_mock, rename_mock, exec_mock): """Test OSTree bootloader config task, no BTRFS""" proxy_mock = storage_mock.get_proxy() proxy_mock.GetArguments.return_value = ["BOOTLOADER-ARGS"] proxy_mock.GetFstabSpec.return_value = "FSTAB-SPEC" proxy_mock.GetRootDevice.return_value = "device-name" devdata_mock.from_structure.return_value.type = "something-non-btrfs-subvolume-ish" with tempfile.TemporaryDirectory() as sysroot: os.makedirs(sysroot + "/boot/grub2") os.mknod(sysroot + "/boot/grub2/grub.cfg") task = ConfigureBootloader(sysroot) task.run() rename_mock.assert_called_once_with( sysroot + "/boot/grub2/grub.cfg", sysroot + "/boot/loader/grub.cfg") symlink_mock.assert_called_once_with( "../loader/grub.cfg", sysroot + "/boot/grub2/grub.cfg") exec_mock.assert_called_once_with("ostree", [ "admin", "instutil", "set-kargs", "BOOTLOADER-ARGS", "root=FSTAB-SPEC" ], root=sysroot)
def dir_run_test(self, conf_mock, symlink_mock, rename_mock, exec_mock): """Test OSTree bootloader config task, dirinstall""" conf_mock.target.is_directory = True with tempfile.TemporaryDirectory() as sysroot: os.makedirs(sysroot + "/boot/grub2") os.mknod(sysroot + "/boot/grub2/grub.cfg") task = ConfigureBootloader(sysroot) task.run() rename_mock.assert_called_once_with( sysroot + "/boot/grub2/grub.cfg", sysroot + "/boot/loader/grub.cfg") symlink_mock.assert_called_once_with( "../loader/grub.cfg", sysroot + "/boot/grub2/grub.cfg") exec_mock.assert_not_called()