diff --git a/src/postorius/forms.py b/src/postorius/forms.py index 3f37460..14638f4 100644 --- a/src/postorius/forms.py +++ b/src/postorius/forms.py @@ -622,6 +622,15 @@ """ emails = ListOfStringsField( label=_('Emails to mass subscribe'), + help_text=_( + 'The following formats are accepted:\n' + 'jdoe@example.com\n' + '\n' + 'John Doe \n' + '"John Doe" \n' + 'jdoe@example.com (John Doe)\n' + 'Use the last three to associate a display name with' + ' the address\n'), ) diff --git a/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_mass_subscribe.yaml b/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_mass_subscribe.yaml deleted file mode 100644 index 752b525..0000000 --- a/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_mass_subscribe.yaml +++ /dev/null @@ -1,551 +0,0 @@ -interactions: -- request: - body: mail_host=example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/domains - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=open_list%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/open_list.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list.example.com - response: - body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": - "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", - "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": - "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", - "volume": 1}'} - headers: - content-length: ['324'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list@example.com/config - response: - body: {string: !!python/unicode '{"acceptable_aliases": [], "admin_immed_notify": - true, "admin_notify_mchanges": false, "administrivia": true, "advertised": - true, "allow_list_posts": true, "anonymous_list": false, "archive_policy": - "public", "autorespond_owner": "none", "autorespond_postings": "none", "autorespond_requests": - "none", "autoresponse_grace_period": "90d", "autoresponse_owner_text": "", - "autoresponse_postings_text": "", "autoresponse_request_text": "", "bounces_address": - "open_list-bounces@example.com", "collapse_alternatives": true, "convert_html_to_plaintext": - false, "created_at": "2005-08-01T07:49:23", "default_member_action": "defer", - "default_nonmember_action": "hold", "description": "", "digest_last_sent_at": - null, "digest_send_periodic": true, "digest_size_threshold": 30.0, "digest_volume_frequency": - "monthly", "digests_enabled": true, "display_name": "Open_list", "filter_content": - false, "first_strip_reply_to": false, "fqdn_listname": "open_list@example.com", - "goodbye_message_uri": "", "http_etag": "\"3d16b6c6d1bb8fed130bd061c70a0894856a4ca8\"", - "include_rfc2369_headers": true, "join_address": "open_list-join@example.com", - "last_post_at": null, "leave_address": "open_list-leave@example.com", "list_name": - "open_list", "mail_host": "example.com", "next_digest_number": 1, "no_reply_address": - "noreply@example.com", "owner_address": "open_list-owner@example.com", "post_id": - 1, "posting_address": "open_list@example.com", "posting_pipeline": "default-posting-pipeline", - "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": - "open_list-request@example.com", "scheme": "http", "send_welcome_message": - true, "subject_prefix": "[Open_list] ", "subscription_policy": "confirm", - "volume": 1, "web_host": "example.com", "welcome_message_uri": "mailman:///welcome.txt"}'} - headers: - content-length: ['1790'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: subscription_policy=open - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode PATCH - uri: http://localhost:9001/3.0/lists/open_list@example.com/config - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: fqdn_listname=moderate_subs%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/moderate_subs.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/moderate_subs.example.com - response: - body: {string: !!python/unicode '{"display_name": "Moderate_subs", "fqdn_listname": - "moderate_subs@example.com", "http_etag": "\"4cf5a031a451ad84a54e4c708cacda8e676e617f\"", - "list_id": "moderate_subs.example.com", "list_name": "moderate_subs", "mail_host": - "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/moderate_subs.example.com", - "volume": 1}'} - headers: - content-length: ['344'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/config - response: - body: {string: !!python/unicode '{"acceptable_aliases": [], "admin_immed_notify": - true, "admin_notify_mchanges": false, "administrivia": true, "advertised": - true, "allow_list_posts": true, "anonymous_list": false, "archive_policy": - "public", "autorespond_owner": "none", "autorespond_postings": "none", "autorespond_requests": - "none", "autoresponse_grace_period": "90d", "autoresponse_owner_text": "", - "autoresponse_postings_text": "", "autoresponse_request_text": "", "bounces_address": - "moderate_subs-bounces@example.com", "collapse_alternatives": true, "convert_html_to_plaintext": - false, "created_at": "2005-08-01T07:49:23", "default_member_action": "defer", - "default_nonmember_action": "hold", "description": "", "digest_last_sent_at": - null, "digest_send_periodic": true, "digest_size_threshold": 30.0, "digest_volume_frequency": - "monthly", "digests_enabled": true, "display_name": "Moderate_subs", "filter_content": - false, "first_strip_reply_to": false, "fqdn_listname": "moderate_subs@example.com", - "goodbye_message_uri": "", "http_etag": "\"bbeb372001a49a25fa038477abd59e8b3c45a20d\"", - "include_rfc2369_headers": true, "join_address": "moderate_subs-join@example.com", - "last_post_at": null, "leave_address": "moderate_subs-leave@example.com", - "list_name": "moderate_subs", "mail_host": "example.com", "next_digest_number": - 1, "no_reply_address": "noreply@example.com", "owner_address": "moderate_subs-owner@example.com", - "post_id": 1, "posting_address": "moderate_subs@example.com", "posting_pipeline": - "default-posting-pipeline", "reply_goes_to_list": "no_munging", "reply_to_address": - "", "request_address": "moderate_subs-request@example.com", "scheme": "http", - "send_welcome_message": true, "subject_prefix": "[Moderate_subs] ", "subscription_policy": - "confirm", "volume": 1, "web_host": "example.com", "welcome_message_uri": - "mailman:///welcome.txt"}'} - headers: - content-length: ['1830'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: subscription_policy=moderate - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode PATCH - uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/config - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: email=test%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/users - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/users/3'] - status: {code: 201, message: Created} -- request: - body: email=fritz%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/users/3/addresses - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/addresses/fritz@example.org'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/users/3 - response: - body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": - "\"b098e212436e9603c36a2c3e536afb238d84024e\"", "is_server_owner": false, - "password": "$6$rounds=701485$u01sS1ACWnQVtLnq$tsdRAMaQ18E9XPPEw6FcTBj9gum1oPBGYjUQug8GOgM//FcQOKVMz1drlUe08wuettxH3jw9rldgThWiTIn500", - "self_link": "http://localhost:9001/3.0/users/3", "user_id": 3}'} - headers: - content-length: ['324'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/users/3/addresses - response: - body: {string: !!python/unicode '{"entries": [{"email": "fritz@example.org", "http_etag": - "\"4acba92c10f9469faebaae91b3b918d8c4955fdc\"", "original_email": "fritz@example.org", - "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/fritz@example.org", - "user": "http://localhost:9001/3.0/users/3"}, {"email": "test@example.com", - "http_etag": "\"bec867729ea260d4f901a156496a3122cea4c457\"", "original_email": - "test@example.com", "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/test@example.com", - "user": "http://localhost:9001/3.0/users/3"}], "http_etag": "\"ddc541a92620b0aedffb9866ab3d7688fbaf29e9\"", - "start": 0, "total_size": 2}'} - headers: - content-length: ['674'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/addresses/fritz@example.org/verify - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/addresses/test@example.com/verify - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: list_id=open_list.example.com&role=owner&subscriber=owner%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/members/5'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/users/owner@example.com - response: - body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": - "\"c1dcbf16536eb2e2151441f4bce2989ab1dab30b\"", "is_server_owner": false, - "self_link": "http://localhost:9001/3.0/users/4", "user_id": 4}'} - headers: - content-length: ['188'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/users/4/addresses - response: - body: {string: !!python/unicode '{"entries": [{"email": "owner@example.com", "http_etag": - "\"1e841ce33417ddddf7c2759638da4b813404e4cf\"", "original_email": "owner@example.com", - "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/owner@example.com", - "user": "http://localhost:9001/3.0/users/4"}], "http_etag": "\"55e06c27436f069b5f8a5c44c3d9e0c97b84b5ee\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['390'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list.example.com - response: - body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": - "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", - "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": - "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", - "volume": 1}'} - headers: - content-length: ['324'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list.example.com/roster/owner - response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/owner@example.com", - "delivery_mode": "regular", "email": "owner@example.com", "http_etag": "\"49eb2113bbe8e2b2adceb819ec761224df7e8ff1\"", - "list_id": "open_list.example.com", "member_id": 5, "moderation_action": "accept", - "role": "owner", "self_link": "http://localhost:9001/3.0/members/5", "user": - "http://localhost:9001/3.0/users/4"}], "http_etag": "\"9e4ef5b93c74bcd28b02c7be63ffc8cf1acbd416\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['489'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list.example.com/roster/moderator - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list.example.com - response: - body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": - "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", - "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": - "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", - "volume": 1}'} - headers: - content-length: ['324'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=fritz%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/members/6'] - status: {code: 201, message: Created} -- request: - body: display_name=None&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=kane%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/members/7'] - status: {code: 201, message: Created} -- request: - body: display_name=None&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=abel%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/members/8'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list@example.com/roster/member - response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/abel@example.org", - "delivery_mode": "regular", "email": "abel@example.org", "http_etag": "\"fd6b64d2f91c4322ccff28c08b05c8bf7757a71f\"", - "list_id": "open_list.example.com", "member_id": 8, "moderation_action": "defer", - "role": "member", "self_link": "http://localhost:9001/3.0/members/8", "user": - "http://localhost:9001/3.0/users/6"}, {"address": "http://localhost:9001/3.0/addresses/fritz@example.org", - "delivery_mode": "regular", "email": "fritz@example.org", "http_etag": "\"4efb85e3a52b4ba559d5704b8aeb42339415fe6e\"", - "list_id": "open_list.example.com", "member_id": 6, "moderation_action": "defer", - "role": "member", "self_link": "http://localhost:9001/3.0/members/6", "user": - "http://localhost:9001/3.0/users/3"}, {"address": "http://localhost:9001/3.0/addresses/kane@example.org", - "delivery_mode": "regular", "email": "kane@example.org", "http_etag": "\"0fbd1e304a840ba3f64785516465a4c8f12ec085\"", - "list_id": "open_list.example.com", "member_id": 7, "moderation_action": "defer", - "role": "member", "self_link": "http://localhost:9001/3.0/members/7", "user": - "http://localhost:9001/3.0/users/5"}], "http_etag": "\"4028fd77c4a4387296c55307d1a339d552a6c097\"", - "start": 0, "total_size": 3}'} - headers: - content-length: ['1257'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/open_list@example.com/requests - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/requests - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains - response: - body: {string: !!python/unicode '{"entries": [{"base_url": "http://example.com", - "description": null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", - "mail_host": "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}], "http_etag": "\"c385b155f8da284bf78dbe075e20f58a30c893ab\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['338'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/users - response: - body: {string: !!python/unicode '{"entries": [{"created_on": "2005-08-01T07:49:23", - "http_etag": "\"b098e212436e9603c36a2c3e536afb238d84024e\"", "is_server_owner": - false, "password": "$6$rounds=701485$u01sS1ACWnQVtLnq$tsdRAMaQ18E9XPPEw6FcTBj9gum1oPBGYjUQug8GOgM//FcQOKVMz1drlUe08wuettxH3jw9rldgThWiTIn500", - "self_link": "http://localhost:9001/3.0/users/3", "user_id": 3}, {"created_on": - "2005-08-01T07:49:23", "http_etag": "\"c1dcbf16536eb2e2151441f4bce2989ab1dab30b\"", - "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/4", - "user_id": 4}, {"created_on": "2005-08-01T07:49:23", "display_name": "None", - "http_etag": "\"d2f85fa2e5dc69b6394e1f61679c379c84b50f6f\"", "is_server_owner": - false, "self_link": "http://localhost:9001/3.0/users/5", "user_id": 5}, {"created_on": - "2005-08-01T07:49:23", "display_name": "None", "http_etag": "\"2cd4496cdf38556bd2872fe98e1902fe60b452ed\"", - "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/6", - "user_id": 6}], "http_etag": "\"be7869efb83edfa9e1451d756cda78c417006625\"", - "start": 0, "total_size": 4}'} - headers: - content-length: ['1047'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/users/3 - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/users/4 - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/users/5 - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/users/6 - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_subscribe_with_name.yaml b/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_subscribe_with_name.yaml new file mode 100644 index 0000000..b1707d2 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/TestSubscription.test_subscribe_with_name.yaml @@ -0,0 +1,789 @@ +interactions: +- request: + body: mail_host=example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/domains + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/domains/example.com'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/domains/example.com + response: + body: {string: !!python/unicode '{"base_url": "http://example.com", "description": + null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": + "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", + "url_host": "example.com"}'} + headers: + content-length: ['233'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: fqdn_listname=open_list%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/lists + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/lists/open_list.example.com'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com + response: + body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": + "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", + "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": + "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", + "volume": 1}'} + headers: + content-length: ['324'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list@example.com/config + response: + body: {string: !!python/unicode '{"acceptable_aliases": [], "admin_immed_notify": + true, "admin_notify_mchanges": false, "administrivia": true, "advertised": + true, "allow_list_posts": true, "anonymous_list": false, "archive_policy": + "public", "autorespond_owner": "none", "autorespond_postings": "none", "autorespond_requests": + "none", "autoresponse_grace_period": "90d", "autoresponse_owner_text": "", + "autoresponse_postings_text": "", "autoresponse_request_text": "", "bounces_address": + "open_list-bounces@example.com", "collapse_alternatives": true, "convert_html_to_plaintext": + false, "created_at": "2005-08-01T07:49:23", "default_member_action": "defer", + "default_nonmember_action": "hold", "description": "", "digest_last_sent_at": + null, "digest_send_periodic": true, "digest_size_threshold": 30.0, "digest_volume_frequency": + "monthly", "digests_enabled": true, "display_name": "Open_list", "filter_content": + false, "first_strip_reply_to": false, "fqdn_listname": "open_list@example.com", + "goodbye_message_uri": "", "http_etag": "\"3d16b6c6d1bb8fed130bd061c70a0894856a4ca8\"", + "include_rfc2369_headers": true, "join_address": "open_list-join@example.com", + "last_post_at": null, "leave_address": "open_list-leave@example.com", "list_name": + "open_list", "mail_host": "example.com", "next_digest_number": 1, "no_reply_address": + "noreply@example.com", "owner_address": "open_list-owner@example.com", "post_id": + 1, "posting_address": "open_list@example.com", "posting_pipeline": "default-posting-pipeline", + "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": + "open_list-request@example.com", "scheme": "http", "send_welcome_message": + true, "subject_prefix": "[Open_list] ", "subscription_policy": "confirm", + "volume": 1, "web_host": "example.com", "welcome_message_uri": "mailman:///welcome.txt"}'} + headers: + content-length: ['1790'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: subscription_policy=open + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'PATCH' + uri: http://localhost:9001/3.0/lists/open_list@example.com/config + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: fqdn_listname=moderate_subs%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/lists + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/lists/moderate_subs.example.com'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/moderate_subs.example.com + response: + body: {string: !!python/unicode '{"display_name": "Moderate_subs", "fqdn_listname": + "moderate_subs@example.com", "http_etag": "\"4cf5a031a451ad84a54e4c708cacda8e676e617f\"", + "list_id": "moderate_subs.example.com", "list_name": "moderate_subs", "mail_host": + "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/moderate_subs.example.com", + "volume": 1}'} + headers: + content-length: ['344'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/config + response: + body: {string: !!python/unicode '{"acceptable_aliases": [], "admin_immed_notify": + true, "admin_notify_mchanges": false, "administrivia": true, "advertised": + true, "allow_list_posts": true, "anonymous_list": false, "archive_policy": + "public", "autorespond_owner": "none", "autorespond_postings": "none", "autorespond_requests": + "none", "autoresponse_grace_period": "90d", "autoresponse_owner_text": "", + "autoresponse_postings_text": "", "autoresponse_request_text": "", "bounces_address": + "moderate_subs-bounces@example.com", "collapse_alternatives": true, "convert_html_to_plaintext": + false, "created_at": "2005-08-01T07:49:23", "default_member_action": "defer", + "default_nonmember_action": "hold", "description": "", "digest_last_sent_at": + null, "digest_send_periodic": true, "digest_size_threshold": 30.0, "digest_volume_frequency": + "monthly", "digests_enabled": true, "display_name": "Moderate_subs", "filter_content": + false, "first_strip_reply_to": false, "fqdn_listname": "moderate_subs@example.com", + "goodbye_message_uri": "", "http_etag": "\"bbeb372001a49a25fa038477abd59e8b3c45a20d\"", + "include_rfc2369_headers": true, "join_address": "moderate_subs-join@example.com", + "last_post_at": null, "leave_address": "moderate_subs-leave@example.com", + "list_name": "moderate_subs", "mail_host": "example.com", "next_digest_number": + 1, "no_reply_address": "noreply@example.com", "owner_address": "moderate_subs-owner@example.com", + "post_id": 1, "posting_address": "moderate_subs@example.com", "posting_pipeline": + "default-posting-pipeline", "reply_goes_to_list": "no_munging", "reply_to_address": + "", "request_address": "moderate_subs-request@example.com", "scheme": "http", + "send_welcome_message": true, "subject_prefix": "[Moderate_subs] ", "subscription_policy": + "confirm", "volume": 1, "web_host": "example.com", "welcome_message_uri": + "mailman:///welcome.txt"}'} + headers: + content-length: ['1830'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: subscription_policy=moderate + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'PATCH' + uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/config + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: email=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/users/1135'] + status: {code: 201, message: Created} +- request: + body: email=fritz%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users/1135/addresses + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/addresses/fritz@example.org'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/1135 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"1fd6bcf6c854a9672a51906e5faf04da2b9f62ba\"", "is_server_owner": false, + "password": "$6$rounds=692162$JeCRXLwguOBOq/FF$ni/WhttNLAbAOC1h0g9APP0hUirQ9ujicZ2TTR93XgMx23KVXe45YQzjh.seki7CoTadrUoSas/RRxwa6Zp3h/", + "self_link": "http://localhost:9001/3.0/users/1135", "user_id": 1135}'} + headers: + content-length: ['330'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/1135/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "fritz@example.org", "http_etag": + "\"9e7f88212a33c761823be56dacfead1be414c2c8\"", "original_email": "fritz@example.org", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/fritz@example.org", + "user": "http://localhost:9001/3.0/users/1135"}, {"email": "test@example.com", + "http_etag": "\"5e940681b85972becdbe7a6e7ab116bf3801b726\"", "original_email": + "test@example.com", "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "user": "http://localhost:9001/3.0/users/1135"}], "http_etag": "\"1f2f911d36040c61c55c59c19a780dfc3050ad73\"", + "start": 0, "total_size": 2}'} + headers: + content-length: ['680'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/addresses/fritz@example.org/verify + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/addresses/test@example.com/verify + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: list_id=open_list.example.com&role=owner&subscriber=owner%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2126'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/owner@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"8712800f913254df879bd8721bb0c5d1f86850c5\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/1136", "user_id": 1136}'} + headers: + content-length: ['194'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/1136/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "owner@example.com", "http_etag": + "\"ba9155b7cc2dd041098f131fda4155024c2ebf87\"", "original_email": "owner@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/owner@example.com", + "user": "http://localhost:9001/3.0/users/1136"}], "http_etag": "\"364752883528d6af8d07437d302cfe7994c020d7\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['393'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com + response: + body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": + "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", + "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": + "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", + "volume": 1}'} + headers: + content-length: ['324'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/roster/owner + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/owner@example.com", + "delivery_mode": "regular", "email": "owner@example.com", "http_etag": "\"6045eaa197195694a048afbb115a184b2c51917f\"", + "list_id": "open_list.example.com", "member_id": 2126, "moderation_action": + "accept", "role": "owner", "self_link": "http://localhost:9001/3.0/members/2126", + "user": "http://localhost:9001/3.0/users/1136"}], "http_etag": "\"74d02c86712706250d022880b00384ee55b93710\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['498'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com + response: + body: {string: !!python/unicode '{"display_name": "Open_list", "fqdn_listname": + "open_list@example.com", "http_etag": "\"6726e101e1dd1de6043eee72f741d4c2479f4735\"", + "list_id": "open_list.example.com", "list_name": "open_list", "mail_host": + "example.com", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/open_list.example.com", + "volume": 1}'} + headers: + content-length: ['324'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: display_name=First+Person&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=test-1%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2127'] + status: {code: 201, message: Created} +- request: + body: display_name=Second+Person&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=test-2%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2128'] + status: {code: 201, message: Created} +- request: + body: display_name=Third+Person&list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=test-3%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2129'] + status: {code: 201, message: Created} +- request: + body: list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=test-4%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2130'] + status: {code: 201, message: Created} +- request: + body: list_id=open_list.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=test-5%40example.org + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + content-type: [application/json; charset=UTF-8] + location: ['http://localhost:9001/3.0/members/2131'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list@example.com/roster/member + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/test-1@example.org", + "delivery_mode": "regular", "email": "test-1@example.org", "http_etag": "\"5d31c42af083c10c2077747b92b981650e8bec35\"", + "list_id": "open_list.example.com", "member_id": 2127, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2127", "user": "http://localhost:9001/3.0/users/1137"}, + {"address": "http://localhost:9001/3.0/addresses/test-2@example.org", "delivery_mode": + "regular", "email": "test-2@example.org", "http_etag": "\"3208675ba10eebe3bab74c1b154174aba8244999\"", + "list_id": "open_list.example.com", "member_id": 2128, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2128", "user": "http://localhost:9001/3.0/users/1138"}, + {"address": "http://localhost:9001/3.0/addresses/test-3@example.org", "delivery_mode": + "regular", "email": "test-3@example.org", "http_etag": "\"27c960699b5539b583df7c6ff74cd2cf9ed7d247\"", + "list_id": "open_list.example.com", "member_id": 2129, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2129", "user": "http://localhost:9001/3.0/users/1139"}, + {"address": "http://localhost:9001/3.0/addresses/test-4@example.org", "delivery_mode": + "regular", "email": "test-4@example.org", "http_etag": "\"ec06a9c097ba6348dffc9e42e293d3c071f206ee\"", + "list_id": "open_list.example.com", "member_id": 2130, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2130", "user": "http://localhost:9001/3.0/users/1140"}, + {"address": "http://localhost:9001/3.0/addresses/test-5@example.org", "delivery_mode": + "regular", "email": "test-5@example.org", "http_etag": "\"8595256474d4d4206184387ff952375b3373575e\"", + "list_id": "open_list.example.com", "member_id": 2131, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2131", "user": "http://localhost:9001/3.0/users/1141"}], + "http_etag": "\"47e32aabc874298c123d1388a54036da4c019e2a\"", "start": 0, "total_size": + 5}'} + headers: + content-length: ['1938'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/member/test-1@example.org + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test-1@example.org", + "delivery_mode": "regular", "email": "test-1@example.org", "http_etag": "\"5d31c42af083c10c2077747b92b981650e8bec35\"", + "list_id": "open_list.example.com", "member_id": 2127, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2127", "user": "http://localhost:9001/3.0/users/1137"}'} + headers: + content-length: ['365'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/member/test-2@example.org + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test-2@example.org", + "delivery_mode": "regular", "email": "test-2@example.org", "http_etag": "\"3208675ba10eebe3bab74c1b154174aba8244999\"", + "list_id": "open_list.example.com", "member_id": 2128, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2128", "user": "http://localhost:9001/3.0/users/1138"}'} + headers: + content-length: ['365'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/member/test-3@example.org + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test-3@example.org", + "delivery_mode": "regular", "email": "test-3@example.org", "http_etag": "\"27c960699b5539b583df7c6ff74cd2cf9ed7d247\"", + "list_id": "open_list.example.com", "member_id": 2129, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2129", "user": "http://localhost:9001/3.0/users/1139"}'} + headers: + content-length: ['365'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/member/test-4@example.org + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test-4@example.org", + "delivery_mode": "regular", "email": "test-4@example.org", "http_etag": "\"ec06a9c097ba6348dffc9e42e293d3c071f206ee\"", + "list_id": "open_list.example.com", "member_id": 2130, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2130", "user": "http://localhost:9001/3.0/users/1140"}'} + headers: + content-length: ['365'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list.example.com/member/test-5@example.org + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test-5@example.org", + "delivery_mode": "regular", "email": "test-5@example.org", "http_etag": "\"8595256474d4d4206184387ff952375b3373575e\"", + "list_id": "open_list.example.com", "member_id": 2131, "role": "member", "self_link": + "http://localhost:9001/3.0/members/2131", "user": "http://localhost:9001/3.0/users/1141"}'} + headers: + content-length: ['365'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test-1@example.org + response: + body: {string: !!python/unicode '{"display_name": "First Person", "email": "test-1@example.org", + "http_etag": "\"83c730522364551d0c8df43e9e62280cbcc63e69\"", "original_email": + "test-1@example.org", "registered_on": "2005-08-01T07:49:23", "self_link": + "http://localhost:9001/3.0/addresses/test-1@example.org", "user": "http://localhost:9001/3.0/users/1137", + "verified_on": "2005-08-01T07:49:23"}'} + headers: + content-length: ['361'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test-2@example.org + response: + body: {string: !!python/unicode '{"display_name": "Second Person", "email": "test-2@example.org", + "http_etag": "\"bd0ca81514dcfe346a8e51ffcc3e7cdd31cd4028\"", "original_email": + "test-2@example.org", "registered_on": "2005-08-01T07:49:23", "self_link": + "http://localhost:9001/3.0/addresses/test-2@example.org", "user": "http://localhost:9001/3.0/users/1138", + "verified_on": "2005-08-01T07:49:23"}'} + headers: + content-length: ['362'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test-3@example.org + response: + body: {string: !!python/unicode '{"display_name": "Third Person", "email": "test-3@example.org", + "http_etag": "\"1df4f6c8a78c411a4c039f21cc040a37f8322eca\"", "original_email": + "test-3@example.org", "registered_on": "2005-08-01T07:49:23", "self_link": + "http://localhost:9001/3.0/addresses/test-3@example.org", "user": "http://localhost:9001/3.0/users/1139", + "verified_on": "2005-08-01T07:49:23"}'} + headers: + content-length: ['361'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test-4@example.org + response: + body: {string: !!python/unicode '{"email": "test-4@example.org", "http_etag": + "\"0e31d7292c1931d82b450316ac6212896bda1f57\"", "original_email": "test-4@example.org", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/test-4@example.org", + "user": "http://localhost:9001/3.0/users/1140", "verified_on": "2005-08-01T07:49:23"}'} + headers: + content-length: ['329'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test-5@example.org + response: + body: {string: !!python/unicode '{"email": "test-5@example.org", "http_etag": + "\"12f52a9dd84ae462f621bdaa53ed73eb6421f0e0\"", "original_email": "test-5@example.org", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/test-5@example.org", + "user": "http://localhost:9001/3.0/users/1141", "verified_on": "2005-08-01T07:49:23"}'} + headers: + content-length: ['329'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/open_list@example.com/requests + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/moderate_subs@example.com/requests + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/domains + response: + body: {string: !!python/unicode '{"entries": [{"base_url": "http://example.com", + "description": null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", + "mail_host": "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", + "url_host": "example.com"}], "http_etag": "\"c385b155f8da284bf78dbe075e20f58a30c893ab\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['338'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/domains/example.com + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode '{"entries": [{"created_on": "2005-08-01T07:49:23", + "http_etag": "\"1fd6bcf6c854a9672a51906e5faf04da2b9f62ba\"", "is_server_owner": + false, "password": "$6$rounds=692162$JeCRXLwguOBOq/FF$ni/WhttNLAbAOC1h0g9APP0hUirQ9ujicZ2TTR93XgMx23KVXe45YQzjh.seki7CoTadrUoSas/RRxwa6Zp3h/", + "self_link": "http://localhost:9001/3.0/users/1135", "user_id": 1135}, {"created_on": + "2005-08-01T07:49:23", "http_etag": "\"8712800f913254df879bd8721bb0c5d1f86850c5\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/1136", + "user_id": 1136}, {"created_on": "2005-08-01T07:49:23", "display_name": "First + Person", "http_etag": "\"8ac5e3c9c7f49fb08ab42716f5223f16a20a6532\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/1137", "user_id": 1137}, + {"created_on": "2005-08-01T07:49:23", "display_name": "Second Person", "http_etag": + "\"6d610dd3c29485e5e3a4e1464bbf0f0fd8cf3854\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/1138", "user_id": 1138}, {"created_on": + "2005-08-01T07:49:23", "display_name": "Third Person", "http_etag": "\"703597e32e931f48ffd4e20fb6b740db845d9b48\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/1139", + "user_id": 1139}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"adebabac5df41d9daa718f777e70b761449a2ee6\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/1140", + "user_id": 1140}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"72b48bbc5c991532f9562ef4d7c6c07117f432c5\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/1141", + "user_id": 1141}], "http_etag": "\"97d04a17871e516a5993a76a40c7ddeaf7cbfa7f\"", + "start": 0, "total_size": 7}'} + headers: + content-length: ['1708'] + content-type: [application/json; charset=UTF-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1135 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1136 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1137 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1138 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1139 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1140 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/1141 + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + status: {code: 204, message: No Content} +version: 1 diff --git a/src/postorius/tests/mailman_api_tests/test_subscriptions.py b/src/postorius/tests/mailman_api_tests/test_subscriptions.py index 4cfb9bd..e687cba 100644 --- a/src/postorius/tests/mailman_api_tests/test_subscriptions.py +++ b/src/postorius/tests/mailman_api_tests/test_subscriptions.py @@ -153,16 +153,29 @@ message = self.assertHasSuccessMessage(response) self.assertIn('Already subscribed', message) - def test_mass_subscribe(self): - # Perform mass subscription + def test_subscribe_with_name(self): User.objects.create_user('testowner', 'owner@example.com', 'pwd') self.open_list.add_owner('owner@example.com') self.client.login(username='testowner', password='pwd') - email_list = 'fritz@example.org\nkane@example.org\nabel@example.org\n' + email_list = """First Person \n + "Second Person" \n + test-3@example.org (Third Person)\n + test-4@example.org\n + \n""" response = self.client.post( reverse('mass_subscribe', args=('open_list.example.com',)), {'emails': email_list}) - self.assertEqual(len(self.open_list.members), 3) + self.assertEqual(len(self.open_list.members), 5) + first = self.open_list.get_member('test-1@example.org') + second = self.open_list.get_member('test-2@example.org') + third = self.open_list.get_member('test-3@example.org') + fourth = self.open_list.get_member('test-4@example.org') + fifth = self.open_list.get_member('test-5@example.org') + self.assertEqual(first.address.display_name, 'First Person') + self.assertEqual(second.address.display_name, 'Second Person') + self.assertEqual(third.address.display_name, 'Third Person') + self.assertIsNone(fourth.address.display_name) + self.assertIsNone(fifth.address.display_name) def test_change_subscription_open(self): # The subscription is changed from an address to another diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index caee204..82085d0 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -16,8 +16,9 @@ # You should have received a copy of the GNU General Public License along with # Postorius. If not, see . -import logging import csv +import email.utils +import logging from django.http import HttpResponse @@ -315,16 +316,20 @@ if request.method == 'POST': form = ListMassSubscription(request.POST) if form.is_valid(): - for email in form.cleaned_data['emails']: + for data in form.cleaned_data['emails']: try: - validate_email(email) - mailing_list.subscribe(address=email, pre_verified=True, - pre_confirmed=True, - pre_approved=True) + # Parse the data to get the address and the display name + display_name, address = email.utils.parseaddr(data) + validate_email(address) + mailing_list.subscribe(address=address, + display_name=display_name, + pre_verified=True, + pre_confirmed=True, + pre_approved=True) messages.success( request, _('The address %(address)s has been' ' subscribed to %(list)s.') % - {'address': email, + {'address': address, 'list': mailing_list.fqdn_listname}) except MailmanApiError: return utils.render_api_error(request) @@ -332,7 +337,7 @@ messages.error(request, e) except ValidationError: messages.error(request, _('The email address %s' - ' is not valid.') % email) + ' is not valid.') % address) else: form = ListMassSubscription() return render(request, 'postorius/lists/mass_subscribe.html',