def _test_get_iso_file_size(self, fixed=True, small=False,
                                found_iso=True):
        device = mock.Mock()
        device.fixed = fixed
        device.size = (self.conf_module.OFFSET_BLOCK_SIZE +
                       self.conf_module.PEEK_SIZE + int(not small))
        iso_id = self.conf_module.ISO_ID
        if not found_iso:
            iso_id = b"pwned"
        iso_off = self.conf_module.OFFSET_ISO_ID - 1
        volume_off = self.conf_module.OFFSET_VOLUME_SIZE - 1
        block_off = self.conf_module.OFFSET_BLOCK_SIZE - 1
        volume_bytes = b'd\x00'      # 100
        block_bytes = b'\x00\x02'    # 512
        device.seek.side_effect = [iso_off, volume_off, block_off]
        device.read.side_effect = [iso_id, volume_bytes, block_bytes]

        response = self._config_manager._get_iso_file_size(device)
        if not fixed or small or not found_iso:
            self.assertIsNone(response)
            return

        seek_calls = [
            mock.call(self.conf_module.OFFSET_ISO_ID),
            mock.call(self.conf_module.OFFSET_VOLUME_SIZE),
            mock.call(self.conf_module.OFFSET_BLOCK_SIZE)]
        read_calls = [
            mock.call(len(iso_id),
                      skip=self.conf_module.OFFSET_ISO_ID - iso_off),
            mock.call(self.conf_module.PEEK_SIZE,
                      skip=self.conf_module.OFFSET_VOLUME_SIZE - volume_off),
            mock.call(self.conf_module.PEEK_SIZE,
                      skip=self.conf_module.OFFSET_BLOCK_SIZE - block_off)]
        device.seek.assert_has_calls(seek_calls)
        device.read.assert_has_calls(read_calls)
        self.assertEqual(100 * 512, response)
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/metadata/services/osconfigdrive/test_windows.py/TestWindowsConfigDriveManager._test_get_iso_file_size/original