The woman had agreed to testify after receiving immunity protecting her from punishment for lying and other violations of the academy 's honor code .