Exemplo n.º 1
0
 def test_clean_one_radio_one_range_poll(self):
     """Test with valid data for one radio and one range poll."""
     form = forms.PollAddForm(data=self.form_data,
                              instance=self.poll,
                              radio_poll_formset=self.radio_poll_formset,
                              range_poll_formset=self.range_poll_formset)
     ok_(form.is_valid())
Exemplo n.º 2
0
 def test_clean_without_radio_or_range_poll(self):
     """Test with invalid data."""
     form = forms.PollAddForm(data=self.form_data,
                              instance=self.poll,
                              radio_poll_formset=(
                                  self.radio_poll_formset_invalid),
                              range_poll_formset=(
                                  self.range_poll_formset_invalid))
     ok_(not form.is_valid())
Exemplo n.º 3
0
    def test_clean_without_radio_or_range_poll(self):
        """Test with empty data.

        If both radio_poll_formset and range_poll_formset are empty,
        then PollForm is invalid.

        """
        form = forms.PollAddForm(
            data=self.form_data,
            instance=self.poll,
            radio_poll_formset=self.radio_poll_formset_empty,
            range_poll_formset=self.range_poll_formset_empty)
        ok_(not form.is_valid())