Example #1
0
 def test_word_survey_requires_one_of_words(self):
     form_data = dict(
         name='word survey 1',
         num_questions_per_player=2,
         choices=self.choices_str,
     )
     form = NewWordSurveyForm(form_data)
     self.assertFalse(form.is_valid())
Example #2
0
 def create_word_survey(self, **kwargs):
     form_data = dict(
         name='ftest',
         num_questions_per_player=2,
         words=stringify(self.words),
         choices=stringify(self.choices),
     )
     form_data.update(kwargs)
     form = NewWordSurveyForm(form_data)
     form.save()
Example #3
0
    def test_create_word_survey_from_file(self):
        form_data = dict(
            name='word survey 1',
            num_questions_per_player=2,
            words_file=self.words_file,
            choices=self.choices_str,
        )

        form = NewWordSurveyForm(form_data)
        self.assertTrue(form.is_valid(), form.errors)

        survey = form.save()
        self.assertEqual(survey.questions.count(), 2)