diff options
| author | Barry Warsaw | 2016-10-26 09:05:43 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-10-26 09:07:40 -0400 |
| commit | 71109df183538fc987cae3eb3f9830531533eaa1 (patch) | |
| tree | 02f1706fc6c4605b798fccf2f991f8e36ee29b10 /src | |
| parent | 88176f08e67a8f6ad706f371167167e75d4a3e04 (diff) | |
| download | mailman-71109df183538fc987cae3eb3f9830531533eaa1.tar.gz mailman-71109df183538fc987cae3eb3f9830531533eaa1.tar.zst mailman-71109df183538fc987cae3eb3f9830531533eaa1.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/model/tests/test_listmanager.py | 18 | ||||
| -rw-r--r-- | src/mailman/rest/docs/lists.rst | 15 |
3 files changed, 27 insertions, 8 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index bc57591b3..3c631525e 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -228,6 +228,8 @@ REST * A list's ``moderator_password`` can be set via the REST API. Given by Andrew Breksa. (Closes #207) * Banned addresses can now be paginated. Given by Amit. (Closes #284) + * Query parameters now allow you to filter mailing lists by the + ``advertised`` boolean parameter. Given by Aurélien Bompard. Other ----- diff --git a/src/mailman/model/tests/test_listmanager.py b/src/mailman/model/tests/test_listmanager.py index 1a643f248..1b89c9ce9 100644 --- a/src/mailman/model/tests/test_listmanager.py +++ b/src/mailman/model/tests/test_listmanager.py @@ -24,6 +24,7 @@ from mailman.app.moderator import hold_message from mailman.config import config from mailman.interfaces.address import InvalidEmailAddressError from mailman.interfaces.autorespond import IAutoResponseSet, Response +from mailman.interfaces.domain import IDomainManager from mailman.interfaces.listmanager import ( IListManager, ListAlreadyExistsError, ListCreatedEvent, ListCreatingEvent, ListDeletedEvent, ListDeletingEvent) @@ -103,7 +104,7 @@ class TestListManager(unittest.TestCase): list_manager.delete(mlist) self.assertIsNone(list_manager.get('ant@example.com')) - def test_find_list(self): + def test_find_advertised_lists(self): ant = create_list('ant@example.com') bee = create_list('bee@example.com') self.assertTrue(bee.advertised) @@ -112,6 +113,21 @@ class TestListManager(unittest.TestCase): self.assertEqual(len(result), 1) self.assertEqual(result[0], bee) + def test_find_by_mail_host_and_advertised(self): + ant = create_list('ant@example.com') + bee = create_list('bee@example.com') + getUtility(IDomainManager).add('example.org') + cat = create_list('cat@example.org') + dog = create_list('dog@example.org') + self.assertTrue(bee.advertised) + ant.advertised = False + self.assertTrue(cat.advertised) + dog.advertised = False + result = getUtility(IListManager).find( + mail_host='example.org', advertised=True) + self.assertEqual(len(result), 1) + self.assertEqual(result[0], cat) + class TestListLifecycleEvents(unittest.TestCase): layer = ConfigLayer diff --git a/src/mailman/rest/docs/lists.rst b/src/mailman/rest/docs/lists.rst index aa9c01362..247b2f4e7 100644 --- a/src/mailman/rest/docs/lists.rst +++ b/src/mailman/rest/docs/lists.rst @@ -52,7 +52,7 @@ You can also query for lists from a particular domain. Advertised lists can be filtered using the ``advertised`` query parameter. :: - >>> mlist = create_list('bird@example.com') + >>> mlist = create_list('elk@example.com') >>> mlist.advertised = False >>> transaction.commit() @@ -67,7 +67,8 @@ Advertised lists can be filtered using the ``advertised`` query parameter. The same applies to lists from a particular domain. - >>> dump_json('http://localhost:9001/3.0/domains/example.com/lists?advertised=true') + >>> dump_json('http://localhost:9001/3.0/domains/example.com' + ... '/lists?advertised=true') entry 0: ... list_id: ant.example.com @@ -105,14 +106,14 @@ page. >>> dump_json('http://localhost:9001/3.0/domains/example.com/lists' ... '?count=1&page=2') entry 0: - display_name: Bird - fqdn_listname: bird@example.com + display_name: Elk + fqdn_listname: elk@example.com http_etag: "..." - list_id: bird.example.com - list_name: bird + list_id: elk.example.com + list_name: elk mail_host: example.com member_count: 0 - self_link: http://localhost:9001/3.0/lists/bird.example.com + self_link: http://localhost:9001/3.0/lists/elk.example.com volume: 1 http_etag: "..." start: 1 |
