forked from CGM_Public/pretix_original
Questions: add min-length to string/text type questions (#6488)
* Questions: add min-length to string/text type questions * fix test
This commit is contained in:
@@ -2970,8 +2970,9 @@ class SeatingTestCase(TestCase):
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize("qtype,answer,expected", [
|
||||
(Question.TYPE_STRING, "a", "a"),
|
||||
(Question.TYPE_TEXT, "v", "v"),
|
||||
(Question.TYPE_STRING, "aaa", "aaa"),
|
||||
(Question.TYPE_STRING, "a", ValidationError),
|
||||
(Question.TYPE_TEXT, "vvv", "vvv"),
|
||||
(Question.TYPE_TEXT, "waaaaay tooooo long", ValidationError),
|
||||
(Question.TYPE_NUMBER, "0.9", ValidationError),
|
||||
(Question.TYPE_NUMBER, "1", Decimal("1")),
|
||||
@@ -3025,6 +3026,7 @@ def test_question_answer_validation(qtype, answer, expected):
|
||||
valid_datetime_max=datetime.datetime(2018, 1, 16, 16, 0, 0, tzinfo=tzoffset(None, 3600)),
|
||||
valid_number_min=Decimal('1'),
|
||||
valid_number_max=Decimal('100'),
|
||||
valid_string_length_min=3,
|
||||
valid_string_length_max=8,
|
||||
)
|
||||
if isinstance(expected, type) and issubclass(expected, Exception):
|
||||
|
||||
Reference in New Issue
Block a user