"""Test cases for the ``workshops`` forms."""

from django.test.testcases import TestCase

from ..forms import WorkshopStepQuestionForm


class WorkshopStepQuestionFormTestCase(TestCase):
    """Test case that tests the ``WorkshopStepQuestionForm`` form."""

    def test_is_valid(self):
        """Test the `is_valid` method."""
        form_data = {
            'title': 'title_test',
            'is_multiple_choices': False,
            'is_all_or_nothing': True
        }
        form = WorkshopStepQuestionForm(data=form_data)
        self.assertFalse(form.is_valid())
        self.assertTrue(form.has_error('is_all_or_nothing'))

        form_data = {
            'title': 'title_test',
            'is_multiple_choices': True,
            'is_all_or_nothing': True
        }
        form = WorkshopStepQuestionForm(data=form_data)
        self.assertTrue(form.is_valid())
        self.assertFalse(form.has_error('is_all_or_nothing'))
