diff --git a/src/postorius/forms.py b/src/postorius/forms.py index 23e1e2f..5d6e7d0 100644 --- a/src/postorius/forms.py +++ b/src/postorius/forms.py @@ -422,10 +422,19 @@ # label=_('No reply address'), # required=False, # ) - posting_pipeline = forms.CharField( + posting_pipeline = forms.ChoiceField( label=_('Pipeline'), + widget=forms.Select(), + required=False, + error_messages={ + 'required': _("Please choose a reply-to action.")}, + choices=( + ("default-owner-pipeline", _("default-owner-pipeline")), + ("default-posting-pipeline", _("default-posting-pipeline")), + ("virgin", _("virgin"))), help_text=( 'Type of pipeline you want to use for this mailing list') + ) # post_id = forms.IntegerField( # label=_('Post ID'), diff --git a/src/postorius/tests/test_forms.py b/src/postorius/tests/test_forms.py index a48c8f5..116212c 100644 --- a/src/postorius/tests/test_forms.py +++ b/src/postorius/tests/test_forms.py @@ -16,7 +16,7 @@ # Postorius. If not, see . from django.utils import unittest -from postorius.forms import UserPreferences, DomainNew +from postorius.forms import UserPreferences, DomainNew, ListNew class UserPreferencesTest(unittest.TestCase): @@ -49,3 +49,26 @@ 'contact_address': 'contact@mailman.most-desirable.org', }) self.assertFalse(form.is_valid()) + +class ListNewTest(unittest.TestCase): + + def test_form_fields_list(self): + form = ListNew({ + 'listname': 'xyz', + 'mail_host': 'mailman.most-desirable.org', + 'list_owner': 'contact@mailman.most-desirable.org', + 'advertise': 'abcd', + 'description': 'The Most Desirable organization', + }) + self.assertTrue(form.is_valid) + + def test_form_fields_list_invalid(self): + form = ListNew({ + 'listname': 'xy#z', + 'mail_host': 'mailman.most-desirable.org', + 'list_owner': 'mailman.most-desirable.org', + 'advertise': 'abcd', + 'description': 'The Most Desirable organization', + }) + self.assertFalse(form.is_valid()) +