1
# Copyright (C) 2014 by the Free Software Foundation, Inc.
3
# This file is part of GNU Mailman.
5
# GNU Mailman is free software: you can redistribute it and/or modify it under
6
# the terms of the GNU General Public License as published by the Free
7
# Software Foundation, either version 3 of the License, or (at your option)
10
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
# You should have received a copy of the GNU General Public License along with
16
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
18
"""Test list configuration via the REST API."""
20
from __future__ import absolute_import, print_function, unicode_literals
30
from mailman.app.lifecycle import create_list
31
from mailman.database.transaction import transaction
32
from mailman.interfaces.mailinglist import IAcceptableAliasSet
33
from mailman.testing.helpers import call_api
34
from mailman.testing.layers import RESTLayer
38
class TestConfiguration(unittest.TestCase):
39
"""Test list configuration via the REST API."""
45
self._mlist = create_list('test@example.com')
47
def test_put_configuration(self):
53
# When using PUT, all writable attributes must be included.
54
resource, response = call_api(
55
'http://localhost:9001/3.0/lists/test@example.com/config',
57
acceptable_aliases=aliases,
58
admin_immed_notify=False,
59
admin_notify_mchanges=True,
63
archive_policy='never',
64
autorespond_owner='respond_and_discard',
65
autorespond_postings='respond_and_continue',
66
autorespond_requests='respond_and_discard',
67
autoresponse_grace_period='45d',
68
autoresponse_owner_text='the owner',
69
autoresponse_postings_text='the mailing list',
70
autoresponse_request_text='the robot',
71
display_name='Fnords',
72
description='This is my mailing list',
73
include_rfc2369_headers=False,
74
allow_list_posts=False,
75
digest_size_threshold=10.5,
76
posting_pipeline='virgin',
78
first_strip_reply_to=True,
79
convert_html_to_plaintext=True,
80
collapse_alternatives=False,
81
reply_goes_to_list='point_to_list',
82
reply_to_address='bee@example.com',
83
send_welcome_message=False,
84
subject_prefix='[ant]',
85
welcome_message_uri='mailman:///welcome.txt',
86
default_member_action='hold',
87
default_nonmember_action='discard',
90
self.assertEqual(response.status, 204)
91
self.assertEqual(self._mlist.display_name, 'Fnords')
92
# All three acceptable aliases were set.
93
self.assertEqual(set(IAcceptableAliasSet(self._mlist).aliases),