diff --git a/setup.py b/setup.py index aaf9f7c..b43a55a 100644 --- a/setup.py +++ b/setup.py @@ -35,8 +35,13 @@ include_package_data=True, install_requires=[ 'Django>=1.8', - 'Django<1.11', + 'Django<1.12', 'django-mailman3', 'mailmanclient', ], + tests_require=[ + "mock", + "vcrpy", + "beautifulsoup4", + ], ) diff --git a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_bug_117.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_bug_117.yaml index 89c9883..ffb4144 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_bug_117.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_bug_117.yaml @@ -188,6 +188,19 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/system/pipelines + response: + body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", + "pipelines": ["default-owner-pipeline", "default-posting-pipeline", "virgin"]}'} + headers: + content-length: ['140'] + 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/foo.example.com response: body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", @@ -328,6 +341,19 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/system/pipelines + response: + body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", + "pipelines": ["default-owner-pipeline", "default-posting-pipeline", "virgin"]}'} + headers: + content-length: ['140'] + 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/foo.example.com response: body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_owner.yaml index b8ff344..fdb73f5 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_owner.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_owner.yaml @@ -189,6 +189,221 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo.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": "\"add2fa2cac49907ba2ad840b737827e8937f2db4\"", + "list_id": "foo.example.com", "member_id": 5572, "moderation_action": "accept", + "role": "owner", "self_link": "http://localhost:9001/3.0/members/5572", "user": + "http://localhost:9001/3.0/users/3686"}], "http_etag": "\"326a8fe9573b4338b939fd2e3eb8a829821a02e3\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['492'] + 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/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/moderator@example.com", + "delivery_mode": "regular", "email": "moderator@example.com", "http_etag": + "\"001e1e23a5fa023843318717cbf9162583678c8f\"", "list_id": "foo.example.com", + "member_id": 5573, "moderation_action": "accept", "role": "moderator", "self_link": + "http://localhost:9001/3.0/members/5573", "user": "http://localhost:9001/3.0/users/3687"}], + "http_etag": "\"555c315968eee0403d87a89a3ed3fba2060aafc3\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['504'] + 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/foo.example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo@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": + "foo-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_footer_uri": + "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": + true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", + "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", + "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": + "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": + "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": + "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": + true, "info": "", "join_address": "foo-join@example.com", "last_post_at": + null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": + "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": + "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": + 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", + "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": + "foo-request@example.com", "send_welcome_message": true, "subject_prefix": + "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": + ""}'} + headers: + content-length: ['1937'] + 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/foo.example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo.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": "\"add2fa2cac49907ba2ad840b737827e8937f2db4\"", + "list_id": "foo.example.com", "member_id": 5572, "moderation_action": "accept", + "role": "owner", "self_link": "http://localhost:9001/3.0/members/5572", "user": + "http://localhost:9001/3.0/users/3686"}], "http_etag": "\"326a8fe9573b4338b939fd2e3eb8a829821a02e3\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['492'] + 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/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/moderator@example.com", + "delivery_mode": "regular", "email": "moderator@example.com", "http_etag": + "\"001e1e23a5fa023843318717cbf9162583678c8f\"", "list_id": "foo.example.com", + "member_id": 5573, "moderation_action": "accept", "role": "moderator", "self_link": + "http://localhost:9001/3.0/members/5573", "user": "http://localhost:9001/3.0/users/3687"}], + "http_etag": "\"555c315968eee0403d87a89a3ed3fba2060aafc3\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['504'] + 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/foo.example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo@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": + "foo-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_footer_uri": + "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": + true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", + "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", + "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": + "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": + "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": + "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": + true, "info": "", "join_address": "foo-join@example.com", "last_post_at": + null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": + "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": + "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": + 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", + "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": + "foo-request@example.com", "send_welcome_message": true, "subject_prefix": + "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": + ""}'} + headers: + content-length: ['1937'] + 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/system/pipelines + response: + body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", + "pipelines": ["default-owner-pipeline", "default-posting-pipeline", "virgin"]}'} + headers: + content-length: ['140'] + 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/system/pipelines response: body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", @@ -404,71 +619,6 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com response: body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", @@ -671,14 +821,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['294'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -686,16 +834,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers 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": "\"add2fa2cac49907ba2ad840b737827e8937f2db4\"", - "list_id": "foo.example.com", "member_id": 5572, "moderation_action": "accept", - "role": "owner", "self_link": "http://localhost:9001/3.0/members/5572", "user": - "http://localhost:9001/3.0/users/3686"}], "http_etag": "\"326a8fe9573b4338b939fd2e3eb8a829821a02e3\"", - "start": 0, "total_size": 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['492'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -703,17 +847,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/moderator@example.com", - "delivery_mode": "regular", "email": "moderator@example.com", "http_etag": - "\"001e1e23a5fa023843318717cbf9162583678c8f\"", "list_id": "foo.example.com", - "member_id": 5573, "moderation_action": "accept", "role": "moderator", "self_link": - "http://localhost:9001/3.0/members/5573", "user": "http://localhost:9001/3.0/users/3687"}], - "http_etag": "\"555c315968eee0403d87a89a3ed3fba2060aafc3\"", "start": 0, "total_size": - 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['504'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -721,14 +860,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['294'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -736,136 +873,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers 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": - "foo-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_footer_uri": - "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": - true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", - "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", - "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": - "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": - "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": - "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": - true, "info": "", "join_address": "foo-join@example.com", "last_post_at": - null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": - "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": - "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": - 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", - "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": - "foo-request@example.com", "send_welcome_message": true, "subject_prefix": - "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": - ""}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['1937'] - 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/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - 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/foo.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": "\"add2fa2cac49907ba2ad840b737827e8937f2db4\"", - "list_id": "foo.example.com", "member_id": 5572, "moderation_action": "accept", - "role": "owner", "self_link": "http://localhost:9001/3.0/members/5572", "user": - "http://localhost:9001/3.0/users/3686"}], "http_etag": "\"326a8fe9573b4338b939fd2e3eb8a829821a02e3\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['492'] - 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/foo.example.com/roster/moderator - response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/moderator@example.com", - "delivery_mode": "regular", "email": "moderator@example.com", "http_etag": - "\"001e1e23a5fa023843318717cbf9162583678c8f\"", "list_id": "foo.example.com", - "member_id": 5573, "moderation_action": "accept", "role": "moderator", "self_link": - "http://localhost:9001/3.0/members/5573", "user": "http://localhost:9001/3.0/users/3687"}], - "http_etag": "\"555c315968eee0403d87a89a3ed3fba2060aafc3\"", "start": 0, "total_size": - 1}'} - headers: - content-length: ['504'] - 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/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - 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/foo@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": - "foo-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_footer_uri": - "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": - true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", - "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", - "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": - "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": - "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": - "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": - true, "info": "", "join_address": "foo-join@example.com", "last_post_at": - null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": - "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": - "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": - 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", - "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": - "foo-request@example.com", "send_welcome_message": true, "subject_prefix": - "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": - ""}'} - headers: - content-length: ['1937'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: diff --git a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_superuser.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_superuser.yaml index ae3d1b9..1bd6749 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_superuser.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListSettingsTest.test_page_accessible_for_superuser.yaml @@ -139,6 +139,121 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo@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": + "foo-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_footer_uri": + "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": + true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", + "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", + "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": + "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": + "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": + "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": + true, "info": "", "join_address": "foo-join@example.com", "last_post_at": + null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": + "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": + "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": + 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", + "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": + "foo-request@example.com", "send_welcome_message": true, "subject_prefix": + "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": + ""}'} + headers: + content-length: ['1937'] + 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/foo@example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + 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/foo@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": + "foo-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_footer_uri": + "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": + true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", + "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", + "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": + "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": + "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": + "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": + true, "info": "", "join_address": "foo-join@example.com", "last_post_at": + null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": + "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": + "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": + 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", + "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": + "foo-request@example.com", "send_welcome_message": true, "subject_prefix": + "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": + ""}'} + headers: + content-length: ['1937'] + 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/system/pipelines + response: + body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", + "pipelines": ["default-owner-pipeline", "default-posting-pipeline", "virgin"]}'} + headers: + content-length: ['140'] + 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/system/pipelines response: body: {string: !!python/unicode '{"http_etag": "\"ff8a7af97caf24e6ca24c5baed447ff532bd1b4f\"", @@ -254,71 +369,6 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo.example.com/archivers - response: - body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", - "mail-archive": true, "mhonarc": true, "prototype": true}'} - headers: - content-length: ['119'] - 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/foo@example.com response: body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", @@ -421,14 +471,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['294'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -436,35 +484,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers 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": - "foo-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_footer_uri": - "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": - true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", - "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", - "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": - "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": - "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": - "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": - true, "info": "", "join_address": "foo-join@example.com", "last_post_at": - null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": - "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": - "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": - 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", - "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": - "foo-request@example.com", "send_welcome_message": true, "subject_prefix": - "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": - ""}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['1937'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -472,14 +497,12 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['294'] + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: @@ -487,35 +510,25 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config + uri: http://localhost:9001/3.0/lists/foo.example.com/archivers 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": - "foo-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_footer_uri": - "", "digest_header_uri": "", "digest_last_sent_at": null, "digest_send_periodic": - true, "digest_size_threshold": 30.0, "digest_volume_frequency": "monthly", - "digests_enabled": true, "display_name": "Foo", "dmarc_mitigate_action": "no_mitigation", - "dmarc_mitigate_unconditionally": false, "dmarc_moderation_notice": "", "dmarc_wrapped_message_text": - "", "filter_content": false, "first_strip_reply_to": false, "footer_uri": - "", "fqdn_listname": "foo@example.com", "goodbye_message_uri": "", "header_uri": - "", "http_etag": "\"1a931726ccc4d9b68005a70db10bf9693957dd2c\"", "include_rfc2369_headers": - true, "info": "", "join_address": "foo-join@example.com", "last_post_at": - null, "leave_address": "foo-leave@example.com", "list_name": "foo", "mail_host": - "example.com", "moderator_password": null, "next_digest_number": 1, "no_reply_address": - "noreply@example.com", "owner_address": "foo-owner@example.com", "post_id": - 1, "posting_address": "foo@example.com", "posting_pipeline": "default-posting-pipeline", - "reply_goes_to_list": "no_munging", "reply_to_address": "", "request_address": - "foo-request@example.com", "send_welcome_message": true, "subject_prefix": - "[Foo] ", "subscription_policy": "confirm", "volume": 1, "welcome_message_uri": - ""}'} + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} headers: - content-length: ['1937'] + content-length: ['119'] + 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/foo.example.com/archivers + response: + body: {string: !!python/unicode '{"http_etag": "\"3dbbbaad592a043938314db0e5249a1ca71d0dc6\"", + "mail-archive": true, "mhonarc": true, "prototype": true}'} + headers: + content-length: ['119'] content-type: [application/json; charset=UTF-8] status: {code: 200, message: OK} - request: diff --git a/src/postorius/tests/mailman_api_tests/test_list_bans.py b/src/postorius/tests/mailman_api_tests/test_list_bans.py index fdebb9b..a549ebc 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_bans.py +++ b/src/postorius/tests/mailman_api_tests/test_list_bans.py @@ -20,6 +20,7 @@ from __future__ import absolute_import, print_function, unicode_literals from allauth.account.models import EmailAddress +from bs4 import BeautifulSoup from django.contrib.auth.models import User from django.core.urlresolvers import reverse @@ -62,12 +63,16 @@ response = self.client.get(self.url) self.assertEqual(response.status_code, 200) self.assertTrue('addban_form' in response.context) - self.assertContains( - response, 'Ban email') + soup = BeautifulSoup(response.content, "html.parser") + tag_input = soup.find("input", { + "class": "form-control", "id": "id_email", + "name": "email", "type": "text", + }) + self.assertIsNotNone(tag_input) + tag_button = soup.find("button", { + "class": "btn btn-primary", "name": "add", "type": "submit", + }) + self.assertIsNotNone(tag_button) def test_context_contains_delete_forms(self): banned = ['banned{}@example.com'.format(i) for i in range(1, 10)] @@ -75,14 +80,15 @@ self.m_list.bans.add(ban) response = self.client.get(self.url) self.assertEqual(response.status_code, 200) + soup = BeautifulSoup(response.content, "html.parser") for ban in banned: - self.assertContains( - response, - '' % ban) - self.assertContains( - response, - '