def METHOD_NAME(self):
    mock_open = mock.mock_open()
    mock_open.side_effect = IOError
    with mock.patch("certbot.compat.filesystem.open", mock_open):
        with mock.patch("certbot.plugins.storage.logger.error") as mock_log:
            self.plugin.storage._data = {"valid": "data"}  # pylint: disable=protected-access
            self.plugin.storage._initialized = True  # pylint: disable=protected-access
            self.plugin.storage._storagepath = "/tmp/whatever"
            with pytest.raises(errors.PluginStorageError):
                self.plugin.storage.save()
            assert "Could not write" in mock_log.call_args[0][0]