def test_something(self): answers = [Answer(user='******', text='A'), Answer(user='******', text='B'), Answer(user='******', text='C')] questions = [Question(text='', answer='', order_number=1)] generate_chart_most_false_answered_questions(questions, answers)
def test_first_question_correct_last_answer_correct_upper_case(self): answers = [ Answer(text='Answer ', user='******'), Answer(text='ANSWER A', user='******') ] next_question, last_correct = get_next_question_and_is_last_answer_correct( QUESTIONS, answers) self.assertEqual(next_question, QUESTIONS[1]) self.assertEqual(last_correct, True)
def test_no_answer_correct(self): answers = [Answer(text='Answer', user='******')] next_question, last_correct = get_next_question_and_is_last_answer_correct( QUESTIONS, answers) self.assertEqual(next_question, QUESTIONS[0]) self.assertEqual(last_correct, False)
def add_answer_to_user(user_id, answer): db.session.add(Answer(user=user_id, text=answer)) db.session.commit()