Esempio n. 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())
Esempio n. 2
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)