Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
762049d0 by Harshit Bansal at 2016-03-03T18:41:29-05:00
Exposed goodbye_message_uri attribute through REST API.
- - - - -
b4f45c41 by Barry Warsaw at 2016-03-03T20:03:00-05:00
Add NEWS and clean up.
- - - - -
4 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/rest/docs/listconf.rst
- src/mailman/rest/listconf.py
- src/mailman/rest/tests/test_listconf.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -148,6 +148,7 @@ REST
arguments. Given by Aurélien Bompard.
* Header match rules for individual mailing lists are now exposed in the REST
API. Given by Aurélien Bompard. (Closes: #192)
+ * Expose `goodbye_message_uri` in the REST API. Given by Harshit Bansal.
Other
-----
=====================================
src/mailman/rest/docs/listconf.rst
=====================================
--- a/src/mailman/rest/docs/listconf.rst
+++ b/src/mailman/rest/docs/listconf.rst
@@ -45,6 +45,7 @@ All readable attributes for a list are available on a
sub-resource.
filter_content: False
first_strip_reply_to: False
fqdn_listname: [email protected]
+ goodbye_message_uri:
http_etag: "..."
include_rfc2369_headers: True
join_address: [email protected]
@@ -107,6 +108,7 @@ When using ``PUT``, all writable attributes must be
included.
... posting_pipeline='virgin',
... filter_content=True,
... first_strip_reply_to=True,
+ ... goodbye_message_uri='mailman:///goodbye.txt',
... convert_html_to_plaintext=True,
... collapse_alternatives=False,
... reply_goes_to_list='point_to_list',
@@ -158,6 +160,8 @@ These values are changed permanently.
display_name: Fnords
filter_content: True
first_strip_reply_to: True
+ fqdn_listname: [email protected]
+ goodbye_message_uri: mailman:///goodbye.txt
...
include_rfc2369_headers: False
...
=====================================
src/mailman/rest/listconf.py
=====================================
--- a/src/mailman/rest/listconf.py
+++ b/src/mailman/rest/listconf.py
@@ -119,6 +119,7 @@ ATTRIBUTES = dict(
digests_enabled=GetterSetter(as_boolean),
filter_content=GetterSetter(as_boolean),
first_strip_reply_to=GetterSetter(as_boolean),
+ goodbye_message_uri=GetterSetter(str),
fqdn_listname=GetterSetter(None),
mail_host=GetterSetter(None),
allow_list_posts=GetterSetter(as_boolean),
=====================================
src/mailman/rest/tests/test_listconf.py
=====================================
--- a/src/mailman/rest/tests/test_listconf.py
+++ b/src/mailman/rest/tests/test_listconf.py
@@ -46,6 +46,7 @@ RESOURCE = dict(
admin_notify_mchanges=True,
administrivia=False,
advertised=False,
+ allow_list_posts=False,
anonymous_list=True,
archive_policy='never',
autorespond_owner='respond_and_discard',
@@ -55,27 +56,27 @@ RESOURCE = dict(
autoresponse_owner_text='the owner',
autoresponse_postings_text='the mailing list',
autoresponse_request_text='the robot',
- display_name='Fnords',
+ collapse_alternatives=False,
+ convert_html_to_plaintext=True,
+ default_member_action='hold',
+ default_nonmember_action='discard',
description='This is my mailing list',
- include_rfc2369_headers=False,
- allow_list_posts=False,
digest_send_periodic=True,
digest_size_threshold=10.5,
digest_volume_frequency='monthly',
digests_enabled=True,
- posting_pipeline='virgin',
+ display_name='Fnords',
filter_content=True,
first_strip_reply_to=True,
- convert_html_to_plaintext=True,
- collapse_alternatives=False,
+ goodbye_message_uri='mailman:///goodbye.txt',
+ include_rfc2369_headers=False,
+ posting_pipeline='virgin',
reply_goes_to_list='point_to_list',
reply_to_address='[email protected]',
send_welcome_message=False,
subject_prefix='[ant]',
subscription_policy='confirm_then_moderate',
welcome_message_uri='mailman:///welcome.txt',
- default_member_action='hold',
- default_nonmember_action='discard',
)
@@ -375,3 +376,43 @@ class TestConfiguration(unittest.TestCase):
'PUT')
self.assertEqual(response.status, 204)
self.assertTrue(self._mlist.digests_enabled)
+
+ def test_get_goodbye_message_uri(self):
+ with transaction():
+ self._mlist.goodbye_message_uri = 'mailman:///goodbye.txt'
+ resource, response = call_api(
+ 'http://localhost:9001/3.0/lists/ant.example.com/config'
+ '/goodbye_message_uri')
+ self.assertEqual(
+ resource['goodbye_message_uri'], 'mailman:///goodbye.txt')
+
+ def test_patch_goodbye_message_uri_parent(self):
+ resource, response = call_api(
+ 'http://localhost:9001/3.0/lists/ant.example.com/config',
+ dict(goodbye_message_uri='mailman:///salutation.txt'),
+ 'PATCH')
+ self.assertEqual(response.status, 204)
+ self.assertEqual(
+ self._mlist.goodbye_message_uri, 'mailman:///salutation.txt')
+
+ def test_patch_goodbye_message_uri(self):
+ resource, response = call_api(
+ 'http://localhost:9001/3.0/lists/ant.example.com/config'
+ '/goodbye_message_uri',
+ dict(goodbye_message_uri='mailman:///salutation.txt'),
+ 'PATCH')
+ self.assertEqual(response.status, 204)
+ self.assertEqual(
+ self._mlist.goodbye_message_uri, 'mailman:///salutation.txt')
+
+ def test_put_goodbye_message_uri(self):
+ with transaction():
+ self._mlist.goodbye_message_uri = 'mailman:///somefile.txt'
+ resource, response = call_api(
+ 'http://localhost:9001/3.0/lists/ant.example.com/config'
+ '/goodbye_message_uri',
+ dict(goodbye_message_uri='mailman:///salutation.txt'),
+ 'PUT')
+ self.assertEqual(response.status, 204)
+ self.assertEqual(
+ self._mlist.goodbye_message_uri, 'mailman:///salutation.txt')
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/b91abf9a0f8db18e341cbbe83c4a20a60efd83d6...b4f45c4128b20d9519126ff464cafd22c1a58a03
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org