Makes our API default to censoring question answers
Closes CNVS-22194 Test Plan: - No functional changes Change-Id: I1969fcbec81e9519c7b48c79f79178fdee389923 Reviewed-on: https://gerrit.instructure.com/59413 Tested-by: Jenkins Reviewed-by: John Corrigan <jcorrigan@instructure.com> QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com> Product-Review: Ryan Taylor <rtaylor@instructure.com>
This commit is contained in:
parent
97bbcd3efb
commit
1f8b10c357
|
@ -29,6 +29,7 @@ module Api::V1::QuizSubmissionQuestion
|
|||
# @param [Hash] meta[:session]
|
||||
# @param [Boolean] meta[:censored] if answer correctness should be censored out
|
||||
def quiz_submission_questions_json(quiz_questions, quiz_submission, meta = {})
|
||||
meta[:censored] ||= true
|
||||
quiz_questions = [ quiz_questions ] unless quiz_questions.kind_of?(Array)
|
||||
includes = (meta[:includes] || []) & INCLUDABLES
|
||||
|
||||
|
|
|
@ -327,17 +327,21 @@ describe Quizzes::QuizSubmissionQuestionsController, :type => :request do
|
|||
end
|
||||
|
||||
it "shouldn't give any answers information" do
|
||||
question = create_question 'multiple_choice'
|
||||
mc = create_question 'multiple_choice'
|
||||
formula = create_question 'numerical'
|
||||
|
||||
json = api_answer({
|
||||
quiz_questions: [{
|
||||
id: question.id,
|
||||
id: mc.id,
|
||||
answer: 1658
|
||||
}]
|
||||
}, {
|
||||
id: formula.id,
|
||||
answer: 40.0
|
||||
}]
|
||||
})
|
||||
|
||||
# TODO: add more question types checks for no leaked answers
|
||||
expect(json['quiz_submission_questions'].flat_map {|h| h["answers"].flat_map(&:keys) }.uniq.include? "weight").to be_falsey
|
||||
expect(json['quiz_submission_questions'][0]["answers"].map(&:keys).uniq.include? "weight").to be_falsey
|
||||
expect(json['quiz_submission_questions'][1]["answers"]).to equal(nil)
|
||||
end
|
||||
|
||||
context 'answering questions' do
|
||||
|
|
Loading…
Reference in New Issue