Merge lp:~prakhar126/postorius/adding_dropdown_option into lp:postorius

Proposed by pjoshi
Status: Merged
Merged at revision: 234
Proposed branch: lp:~prakhar126/postorius/adding_dropdown_option
Merge into: lp:postorius
Diff against target: 56 lines (+33/-1)
2 files modified
src/postorius/forms.py (+10/-1)
src/postorius/tests/test_forms.py (+23/-0)
To merge this branch: bzr merge lp:~prakhar126/postorius/adding_dropdown_option
Reviewer Review Type Date Requested Status
Terri Needs Fixing
Review via email: mp+252878@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Terri (terriko) wrote :

I'm finding some errors in the tests here (missing commas, for example). I'll see if they're things I can fix relatively quickly.

review: Needs Fixing
Revision history for this message
Terri (terriko) wrote :

Here's the fixed code. There were a lot of syntax errors here. In future, please actually run the tests before you submit a merge proposal!

class ListNewTest(unittest.TestCase):

    def test_form_fields_list(self):
        form = ListNew({
            'listname': 'xyz',
            'mail_host': 'mailman.most-desirable.org',
            'list_owner': '<email address hidden>',
            '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())

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/postorius/forms.py'
2--- src/postorius/forms.py 2015-02-09 14:35:44 +0000
3+++ src/postorius/forms.py 2015-03-13 10:43:56 +0000
4@@ -426,10 +426,19 @@
5 # label=_('No reply address'),
6 # required=False,
7 # )
8- posting_pipeline = forms.CharField(
9+ posting_pipeline = forms.ChoiceField(
10 label=_('Pipeline'),
11+ widget=forms.Select(),
12+ required=False,
13+ error_messages={
14+ 'required': _("Please choose a reply-to action.")},
15+ choices=(
16+ ("default-owner-pipeline", _("default-owner-pipeline")),
17+ ("default-posting-pipeline", _("default-posting-pipeline")),
18+ ("virgin", _("virgin"))),
19 help_text=(
20 'Type of pipeline you want to use for this mailing list')
21+
22 )
23 # post_id = forms.IntegerField(
24 # label=_('Post ID'),
25
26=== modified file 'src/postorius/tests/test_forms.py'
27--- src/postorius/tests/test_forms.py 2015-02-09 14:35:44 +0000
28+++ src/postorius/tests/test_forms.py 2015-03-13 10:43:56 +0000
29@@ -49,3 +49,26 @@
30 'contact_address': 'contact@mailman.most-desirable.org',
31 })
32 self.assertFalse(form.is_valid())
33+
34+class ListNewTest(unittest.TestCase):
35+
36+ def test_form_fields_list(self):
37+ form = ListNew({
38+ 'listname': 'xyz'
39+ 'mail_host': 'mailman.most-desirable.org'
40+ 'list_owner': 'contact@mailman.most-desirable.org'
41+ 'advertise': 'abcd'
42+ 'description': 'The Most Desirable organization'
43+ })
44+ self.assertTrue(form.is_valid)
45+
46+ def test_form_fields_list_invalid(self):
47+ form = ListNew({
48+ 'listname': ''xy#z'
49+ 'mail_host': 'mailman.most-desirable.org'
50+ 'list_owner': 'mailman.most-desirable.org'
51+ 'advertise': 'abcd'
52+ 'description': 'The Most Desirable organization'
53+ })
54+ self.assertFalse(form.is_valid)
55+
56\ No newline at end of file

Subscribers

People subscribed via source and target branches