@mock.patch("six.moves.builtins.open", new=OPEN)
    def test_write_iso_file(self):
        file_path = "fake\\path"
        file_size = 100 * 512
        sector_size = self.conf_module.MAX_SECTOR_SIZE
        offsets = list(range(0, file_size, sector_size))
        remain = sector_size % file_size
        reads = ([b"\x00" * sector_size] *
                 (len(offsets) - int(bool(remain))) +
                 ([b"\x00" * remain] if remain else []))

        device = mock.Mock()
        device_seek_calls = [mock.call(off) for off in offsets]
        device_read_calls = [
            mock.call(min(sector_size, file_size - off), skip=0)
            for off in offsets]
        stream_write_calls = [mock.call(read) for read in reads]
        device.seek.side_effect = offsets
        device.read.side_effect = reads

        self._config_manager._write_iso_file(device, file_path, file_size)
        device.seek.assert_has_calls(device_seek_calls)
        device.read.assert_has_calls(device_read_calls)
        OPEN.return_value.write.assert_has_calls(stream_write_calls)
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/metadata/services/osconfigdrive/test_windows.py/TestWindowsConfigDriveManager.test_write_iso_file/swapped operands of `%`