'Create a new survey and add answers to it'

@ddt.data(None, 'foo/bar/baz')
def test_single_user_answers(self, course_id):

    survey = self._create_test_survey()
    self.assertIsNotNone(survey)
    survey.save_user_answers(self.student, self.student_answers, course_id)
    self.assertTrue(survey.has_user_answered_survey(self.student))
    all_answers = survey.get_answers()
    self.assertEquals(len(all_answers.keys()), 1)
    self.assertIn(self.student.id, all_answers)
    self.assertEquals(all_answers[self.student.id], self.student_answers)
    answers = survey.get_answers(self.student)
    self.assertEquals(len(answers.keys()), 1)
    self.assertIn(self.student.id, answers)
    self.assertEquals(all_answers[self.student.id], self.student_answers)
    answer_objs = SurveyAnswer.objects.filter(user=self.student, form=survey)
    for answer_obj in answer_objs:
        if course_id:
            self.assertEquals(unicode(answer_obj.course_key), course_id)
        else:
            self.assertIsNone(answer_obj.course_key)
