mirror of
https://github.com/pretix/pretix.git
synced 2026-09-12 16:04:42 +00:00
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:
@@ -2479,6 +2479,7 @@ TEST_QUESTION_RES = {
|
||||
"valid_datetime_min": None,
|
||||
"valid_datetime_max": None,
|
||||
"valid_file_portrait": False,
|
||||
"valid_string_length_min": None,
|
||||
"valid_string_length_max": None,
|
||||
"help_text": {"en": "This is an example question"},
|
||||
"options": [
|
||||
|
||||
@@ -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