Exemplo n.º 1
0
 def _respond_to_questions(questions):
     d1 = {}
     d2 = {}
     d3 = {}
     d4 = {}
     d1['question_id'] = questions[0]
     d2['question_id'] = questions[1]
     d3['question_id'] = questions[2]
     d4['question_id'] = questions[3]
     d1['response_format'] = Question().RESPONSE_FREE
     d2['response_format'] = Question().RESPONSE_MULTIPLE_CHOICE
     d3['response_format'] = Question().RESPONSE_TRUE_OR_FALSE
     d4['response_format'] = Question().RESPONSE_RATING
     d1['response_data'] = lorem_ipsum.lorem_ipsum()
     d2['response_data'] = random.choice(["alpha", "beta", "gamma", "delta"])
     d3['response_data'] = random.choice([True, False])
     d4['response_data'] = random.randint(0, 10)
     r1 = QuestionResponse().create_item(d1)
     r2 = QuestionResponse().create_item(d2)
     r3 = QuestionResponse().create_item(d3)
     r4 = QuestionResponse().create_item(d4)
     return [r1, r2, r3, r4]
Exemplo n.º 2
0
 def create_generic_item(self):
     data = self.default()
     data['title'] = lorem_ipsum.lorem_ipsum()
     data['response_format'] = random.choice(self.USER_RESPONSE_FORMAT)
     data['options'] = self.create_generic_options(data['response_format'])
     return Question().create_item(data)