test restoring of mocked function on error