diff --git a/src/postorius/templates/postorius/domain/confirm_delete.html b/src/postorius/templates/postorius/domain/confirm_delete.html index cc5545f..e58c750 100644 --- a/src/postorius/templates/postorius/domain/confirm_delete.html +++ b/src/postorius/templates/postorius/domain/confirm_delete.html @@ -15,7 +15,7 @@

{% trans 'Are you sure you want to permanently delete this domain?' %}

-
+ {% csrf_token %} {% trans 'Cancel' %} diff --git a/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_new_domain_created_with_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_new_domain_created_with_owner.yaml index 8d8fa2f..b6c97ae 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_new_domain_created_with_owner.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_new_domain_created_with_owner.yaml @@ -3,10 +3,10 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/su@example.com response: - body: {string: !!python/unicode 404 Not Found} + body: {string: !!python/unicode '404 Not Found'} headers: content-length: ['13'] content-type: [application/json; charset=utf-8] @@ -15,8 +15,8 @@ body: base_url=http%3A%2F%2Fexample.com&description=A+new+Domain.&mail_host=example.com&owner=su%40example.com headers: accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST + !!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 ''} @@ -28,37 +28,37 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/su@example.com response: body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": - "\"82f042707bad8528d367f38ace98ee0d7ff05e57\"", "is_server_owner": false, - "self_link": "http://localhost:9001/3.0/users/107", "user_id": 107}'} + "\"976a4412eb9cb5d0caff87e1fb125a75d8557190\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/2617", "user_id": 2617}'} headers: - content-length: ['192'] + 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/107/addresses + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2617/addresses response: body: {string: !!python/unicode '{"entries": [{"email": "su@example.com", "http_etag": - "\"0a9acce49bac565c4c9a6f82cbfa1071cf8431f9\"", "original_email": "su@example.com", + "\"7728784f9ba62dfdd42fe755547e5fbd4b6ebc64\"", "original_email": "su@example.com", "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/su@example.com", - "user": "http://localhost:9001/3.0/users/107"}], "http_etag": "\"3b2c12fee9e1570dd7a25f21b1bfa834bc650689\"", + "user": "http://localhost:9001/3.0/users/2617"}], "http_etag": "\"a1d3c7326c76c0eb992cbb349a0fcc9ac092a419\"", "start": 0, "total_size": 1}'} headers: - content-length: ['383'] + content-length: ['384'] content-type: [application/json; charset=utf-8] status: {code: 200, message: OK} - request: body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains response: body: {string: !!python/unicode '{"entries": [{"base_url": "http://example.com", @@ -74,7 +74,7 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com response: body: {string: !!python/unicode '{"base_url": "http://example.com", "description": @@ -89,7 +89,7 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com response: body: {string: !!python/unicode '{"base_url": "http://example.com", "description": @@ -104,7 +104,7 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com response: body: {string: !!python/unicode '{"base_url": "http://example.com", "description": @@ -119,37 +119,37 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com/owners response: body: {string: !!python/unicode '{"entries": [{"created_on": "2005-08-01T07:49:23", - "http_etag": "\"82f042707bad8528d367f38ace98ee0d7ff05e57\"", "is_server_owner": - false, "self_link": "http://localhost:9001/3.0/users/107", "user_id": 107}], - "http_etag": "\"626cd7e8adb007ccfba5661536ba21d5aeb4209f\"", "start": 0, "total_size": + "http_etag": "\"976a4412eb9cb5d0caff87e1fb125a75d8557190\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2617", "user_id": 2617}], + "http_etag": "\"ff75a8caf08c7fc6205bb7a4a8f1a41e03062b76\"", "start": 0, "total_size": 1}'} headers: - content-length: ['297'] + content-length: ['299'] content-type: [application/json; charset=utf-8] status: {code: 200, message: OK} - request: body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/su@example.com response: body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": - "\"82f042707bad8528d367f38ace98ee0d7ff05e57\"", "is_server_owner": false, - "self_link": "http://localhost:9001/3.0/users/107", "user_id": 107}'} + "\"976a4412eb9cb5d0caff87e1fb125a75d8557190\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/2617", "user_id": 2617}'} headers: - content-length: ['192'] + 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 DELETE + method: !!python/unicode 'DELETE' uri: http://localhost:9001/3.0/domains/example.com response: body: {string: !!python/unicode ''} @@ -160,7 +160,7 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", @@ -173,24 +173,24 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET + 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": "\"82f042707bad8528d367f38ace98ee0d7ff05e57\"", "is_server_owner": - false, "self_link": "http://localhost:9001/3.0/users/107", "user_id": 107}], - "http_etag": "\"626cd7e8adb007ccfba5661536ba21d5aeb4209f\"", "start": 0, "total_size": + "http_etag": "\"976a4412eb9cb5d0caff87e1fb125a75d8557190\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2617", "user_id": 2617}], + "http_etag": "\"ff75a8caf08c7fc6205bb7a4a8f1a41e03062b76\"", "start": 0, "total_size": 1}'} headers: - content-length: ['297'] + content-length: ['299'] 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/107 + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/users/2617 response: body: {string: !!python/unicode ''} headers: diff --git a/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_validation_of_mail_host.yaml b/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_validation_of_mail_host.yaml new file mode 100644 index 0000000..9a24357 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/DomainCreationTest.test_validation_of_mail_host.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/su@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/domains + 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/users + 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} +version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/ListCreationTest.test_listname_validation.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListCreationTest.test_listname_validation.yaml new file mode 100644 index 0000000..8ae4236 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListCreationTest.test_listname_validation.yaml @@ -0,0 +1,98 @@ +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/users/su@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + status: {code: 404, message: Not Found} +- 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 '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: 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 '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_not_accessible_for_moderator.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_not_accessible_for_moderator.yaml new file mode 100644 index 0000000..b9b54b7 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_not_accessible_for_moderator.yaml @@ -0,0 +1,492 @@ +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=foo%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/foo.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/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: list_id=foo.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/4580'] + status: {code: 201, message: Created} +- request: + body: list_id=foo.example.com&role=moderator&subscriber=moderator%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/4581'] + status: {code: 201, message: Created} +- 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/2603'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2603 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"01028cf2252303ed31683073cf13726312408108\"", "is_server_owner": false, + "password": "$6$rounds=662618$6xrZ4rQrBB8hSzaL$RdA1Z9Q95E7DOH10vz0rB5Vzrorluw.BWbPJmt2cZ2Mc3yDOGo6r1wJrtgaiG5p4jU/hrMkuqnfUpi0MjAorW/", + "self_link": "http://localhost:9001/3.0/users/2603", "user_id": 2603}'} + 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/2603/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"e9e4e8cc659decdfe2f95dcf2216529ac067d24d\"", "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/2603"}], "http_etag": "\"607cbe30e196f5a431003e0232150df4fe4269c1\"", + "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 '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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=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/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/4582'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/moderator@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"2654dd9289836cf68b2608957880cde5da86e8c2\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/2569", "user_id": 2569}'} + 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/2569/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "moderator@example.com", + "http_etag": "\"9c8285f78e80becdaedbc1f04bf2a3e7330ed2a1\"", "original_email": + "moderator@example.com", "registered_on": "2005-08-01T07:49:23", "self_link": + "http://localhost:9001/3.0/addresses/moderator@example.com", "user": "http://localhost:9001/3.0/users/2569"}], + "http_etag": "\"6f5f79afccc63020c68b96a858389175e893fda7\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['405'] + 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": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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": "\"188510c419f7a90a33608baac9853bc2904e26ce\"", + "list_id": "foo.example.com", "member_id": 4580, "moderation_action": "accept", + "role": "owner", "self_link": "http://localhost:9001/3.0/members/4580", "user": + "http://localhost:9001/3.0/users/2568"}], "http_etag": "\"0d49e02aa1e0558098f5e6804890e551e22f94c7\"", + "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": + "\"a2050f1e3e8a8754c16b1ac2a6d270c743c27743\"", "list_id": "foo.example.com", + "member_id": 4581, "moderation_action": "accept", "role": "moderator", "self_link": + "http://localhost:9001/3.0/members/4581", "user": "http://localhost:9001/3.0/users/2569"}], + "http_etag": "\"d5fb908d143b060c38a4cb0eb2f23d40c62fc5e1\"", "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/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"}, {"base_url": "http://example.net", "description": + null, "http_etag": "\"0d2f2e58986938da3ee32b4625c8d2ee7818f5f8\"", "mail_host": + "example.net", "self_link": "http://localhost:9001/3.0/domains/example.net", + "url_host": "example.net"}, {"base_url": "http://example.org", "description": + "Example domain", "http_etag": "\"c13e61a042d2abbb10bb7f7547024b919e376dc2\"", + "mail_host": "example.org", "self_link": "http://localhost:9001/3.0/domains/example.org", + "url_host": "example.org"}, {"base_url": "http://allmy.example.com", "description": + "My new domain", "http_etag": "\"8a5f64e33a236a8c80a4a4ff64b0a7449940df6a\"", + "mail_host": "my.example.com", "self_link": "http://localhost:9001/3.0/domains/my.example.com", + "url_host": "allmy.example.com"}, {"base_url": "http://your.example.com", + "description": null, "http_etag": "\"d93fe2a3f55329c10082ea5d8b0bd8ce2461043b\"", + "mail_host": "your.example.com", "self_link": "http://localhost:9001/3.0/domains/your.example.com", + "url_host": "your.example.com"}], "http_etag": "\"742f26b8b146ac7a6260742c0093595b61664a75\"", + "start": 0, "total_size": 5}'} + headers: + content-length: ['1339'] + 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/my.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 '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 'DELETE' + uri: http://localhost:9001/3.0/domains/example.net + 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/domains/example.org + 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/domains/your.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": "\"aa8770f902ca0dad27dfd5e88a1841a4c1531810\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2568", "user_id": 2568}, + {"created_on": "2005-08-01T07:49:23", "http_etag": "\"2654dd9289836cf68b2608957880cde5da86e8c2\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2569", + "user_id": 2569}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"223506b993d7e04dc617c384eeb77461c7749dff\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2580", + "user_id": 2580}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"aa7513fa55cc62c9d733aa5b931cc497810c6631\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2581", + "user_id": 2581}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"668c2ec8b4864cea88abd8ddd087fa6cfb0356ce\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2582", + "user_id": 2582}, {"created_on": "2005-08-01T07:49:23", "display_name": "Dave + Person", "http_etag": "\"a287a9e4977d07563fc1eaaa75afebd06401e790\"", "is_server_owner": + false, "password": "$6$rounds=681319$eO2clXJM58s3gOxm$Alpuibs7epqwFp8GCyK/k7egEUeBApu/59rJiL5i14pUdjrQVE1n3m8Y9pysiw9TwRyVYCVGR/OQT.WuK1OWK1", + "self_link": "http://localhost:9001/3.0/users/2587", "user_id": 2587}, {"created_on": + "2005-08-01T07:49:23", "display_name": "Elly Person", "http_etag": "\"d1ffb270e5d16fa37d28b0e4111cf616dd60356d\"", + "is_server_owner": false, "password": "$6$rounds=624384$OdUJXTpTIQc6m59K$mQI7ucB.iYcCykBOJfSl5qi/Z03w33JYGBN4NaL/T2tFoHyXZMQfDPntXjEuXJy.rfa0qJLntBzxcZR9W9KiC.", + "self_link": "http://localhost:9001/3.0/users/2588", "user_id": 2588}, {"created_on": + "2005-08-01T07:49:23", "display_name": "Gwen Person", "http_etag": "\"bec5ffb740c09d3e762df7f0cdb9305e0d387fd8\"", + "is_server_owner": true, "password": "$6$rounds=596969$A4ggUrP0senuLkXj$bNtPAxyzjxhpaTEQz20flvmB4Cy5oaxy1GL.KXiN99Dyc3mQpzPtiVScPxaQgd435VGoXcvG82tUhlkg8oXNm/", + "self_link": "http://localhost:9001/3.0/users/2589", "user_id": 2589}, {"created_on": + "2005-08-01T07:49:23", "display_name": "Herb Person", "http_etag": "\"e84961f5b0f9c35088de0fb978e211837b917038\"", + "is_server_owner": false, "password": "$6$rounds=633984$WXWlhWBAmeaSxlNn$HXr4dBquDZnGnnmuMUTGIi.53hVXyrjhrIg/JrnNPPGel9uEaH02MP7l/QkLtKL9ozD3016FrW/ywRYMZDWI.0", + "self_link": "http://localhost:9001/3.0/users/2590", "user_id": 2590}, {"created_on": + "2005-08-01T07:49:23", "http_etag": "\"0a9d7a56e2efeb7142d245b84c85bf3b13efec85\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2591", + "user_id": 2591}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"66bb81cab0c048684620f5246d9ff44b0b23d86c\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2592", + "user_id": 2592}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"01028cf2252303ed31683073cf13726312408108\"", + "is_server_owner": false, "password": "$6$rounds=662618$6xrZ4rQrBB8hSzaL$RdA1Z9Q95E7DOH10vz0rB5Vzrorluw.BWbPJmt2cZ2Mc3yDOGo6r1wJrtgaiG5p4jU/hrMkuqnfUpi0MjAorW/", + "self_link": "http://localhost:9001/3.0/users/2603", "user_id": 2603}], "http_etag": + "\"0e96e847fe033cfbdb9c7eb64aab812270ccc370\"", "start": 0, "total_size": + 12}'} + headers: + content-length: ['3259'] + 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/2568 + 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/2569 + 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/2580 + 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/2581 + 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/2582 + 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/2587 + 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/2588 + 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/2589 + 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/2590 + 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/2591 + 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/2592 + 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/2603 + 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/ListMembersOptionsTest.test_page_accessible_for_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_accessible_for_owner.yaml new file mode 100644 index 0000000..b405e44 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_accessible_for_owner.yaml @@ -0,0 +1,372 @@ +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=foo%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/foo.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/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: list_id=foo.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/4583'] + status: {code: 201, message: Created} +- request: + body: list_id=foo.example.com&role=moderator&subscriber=moderator%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/4584'] + status: {code: 201, message: Created} +- 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/2606'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2606 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"22ea12a200ab0ec16bd6539694c2c43c8baa831f\"", "is_server_owner": false, + "password": "$6$rounds=592740$GhFSxGf/D.JuEMlm$EHqGxzCqkZJy70pC5QCEAmgVdeFLZ.MaNHWXjVBZM2/agUE/jTWXiIXC.B6lJMB/a5KASUA8Eg6ZIxuyIIomG0", + "self_link": "http://localhost:9001/3.0/users/2606", "user_id": 2606}'} + 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/2606/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"0cf7f7537b8386dc0366e045de413ba99cbcd994\"", "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/2606"}], "http_etag": "\"c3138b56102ee3c7307dc4c05ac4fb46f92ae07e\"", + "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 '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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=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/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/4585'] + 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": + "\"603f74b10f4ed40a9fecc9e81e6540c6ea6599de\"", "is_server_owner": false, + "self_link": "http://localhost:9001/3.0/users/2604", "user_id": 2604}'} + 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/2604/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "owner@example.com", "http_etag": + "\"618e31d1f8dc3d0198606c518e137335697251a0\"", "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/2604"}], "http_etag": "\"de936bc8dad370bf5d8d00ce9955c3555aa5e09f\"", + "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/foo.example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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": "\"244d66ca9fc48d0a5132a6d9d22f31923ad73c15\"", + "list_id": "foo.example.com", "member_id": 4583, "moderation_action": "accept", + "role": "owner", "self_link": "http://localhost:9001/3.0/members/4583", "user": + "http://localhost:9001/3.0/users/2604"}], "http_etag": "\"645065ef66e69dfde1af5cd5a19f5f70edf8ce5c\"", + "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": + "\"af44ee1e674d4d899f02528d43e381fbefd9bc89\"", "list_id": "foo.example.com", + "member_id": 4584, "moderation_action": "accept", "role": "moderator", "self_link": + "http://localhost:9001/3.0/members/4584", "user": "http://localhost:9001/3.0/users/2605"}], + "http_etag": "\"f4781ed9c09601404f5e797264420fcbef476a27\"", "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": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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 + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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/member/test@example.com + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test@example.com", + "delivery_mode": "regular", "email": "test@example.com", "http_etag": "\"85368e96033fe3cdf8ff868afea6b320647b13c4\"", + "list_id": "foo.example.com", "member_id": 4585, "moderation_action": "defer", + "role": "member", "self_link": "http://localhost:9001/3.0/members/4585", "user": + "http://localhost:9001/3.0/users/2606"}'} + headers: + content-length: ['385'] + 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/members/4585/preferences + response: + body: {string: !!python/unicode '{"http_etag": "\"99f1ebb90d41016f39dd1581700bd794ffe8b8e4\"", + "self_link": "http://localhost:9001/3.0/members/4585/preferences"}'} + headers: + content-length: ['128'] + 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": "\"603f74b10f4ed40a9fecc9e81e6540c6ea6599de\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2604", "user_id": 2604}, + {"created_on": "2005-08-01T07:49:23", "http_etag": "\"5ad5052034de55092e6e401be1af4e0d607be467\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2605", + "user_id": 2605}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"22ea12a200ab0ec16bd6539694c2c43c8baa831f\"", + "is_server_owner": false, "password": "$6$rounds=592740$GhFSxGf/D.JuEMlm$EHqGxzCqkZJy70pC5QCEAmgVdeFLZ.MaNHWXjVBZM2/agUE/jTWXiIXC.B6lJMB/a5KASUA8Eg6ZIxuyIIomG0", + "self_link": "http://localhost:9001/3.0/users/2606", "user_id": 2606}], "http_etag": + "\"f01e11defd61036ab180f55ffbcabc2bc17d8411\"", "start": 0, "total_size": + 3}'} + headers: + content-length: ['827'] + 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/2604 + 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/2605 + 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/2606 + 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/ListMembersOptionsTest.test_page_accessible_for_superuser.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_accessible_for_superuser.yaml new file mode 100644 index 0000000..7802ed6 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_accessible_for_superuser.yaml @@ -0,0 +1,304 @@ +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=foo%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/foo.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/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: list_id=foo.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/4586'] + status: {code: 201, message: Created} +- request: + body: list_id=foo.example.com&role=moderator&subscriber=moderator%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/4587'] + status: {code: 201, message: Created} +- 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/2609'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2609 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"4b4075c4ce76bfca6a0ec15694426f263188b6ad\"", "is_server_owner": false, + "password": "$6$rounds=619999$kqmF6jxKXqF9AfSt$opfAIBt9Y8UTNF9X3wfrLGDlLQFn4mlZQf52Ya5GOjy1xvLsDefq8rP8.TK1keMArFQ/33szPXXLndGwofF0V1", + "self_link": "http://localhost:9001/3.0/users/2609", "user_id": 2609}'} + 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/2609/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"c0868c33abd342e340b9b8d4d4f52ae32cb5e48f\"", "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/2609"}], "http_etag": "\"49778316c189c9c5f4389deb15349becf65261ea\"", + "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 '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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=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/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/4588'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/su@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + status: {code: 404, message: Not Found} +- 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": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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 + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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/member/test@example.com + response: + body: {string: !!python/unicode '{"address": "http://localhost:9001/3.0/addresses/test@example.com", + "delivery_mode": "regular", "email": "test@example.com", "http_etag": "\"73b340a57ed1411204c8922abf81cedbdcd75b5d\"", + "list_id": "foo.example.com", "member_id": 4588, "moderation_action": "defer", + "role": "member", "self_link": "http://localhost:9001/3.0/members/4588", "user": + "http://localhost:9001/3.0/users/2609"}'} + headers: + content-length: ['385'] + 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/members/4588/preferences + response: + body: {string: !!python/unicode '{"http_etag": "\"caf20559435fb7e0fc0bd9d70ac3f6e98a5a17cd\"", + "self_link": "http://localhost:9001/3.0/members/4588/preferences"}'} + headers: + content-length: ['128'] + 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": "\"59a4e036e3acede27869483a1bbbe9413fadb703\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2607", "user_id": 2607}, + {"created_on": "2005-08-01T07:49:23", "http_etag": "\"e1a7ef501eb310e42acda39d402a3ad96588b032\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2608", + "user_id": 2608}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"4b4075c4ce76bfca6a0ec15694426f263188b6ad\"", + "is_server_owner": false, "password": "$6$rounds=619999$kqmF6jxKXqF9AfSt$opfAIBt9Y8UTNF9X3wfrLGDlLQFn4mlZQf52Ya5GOjy1xvLsDefq8rP8.TK1keMArFQ/33szPXXLndGwofF0V1", + "self_link": "http://localhost:9001/3.0/users/2609", "user_id": 2609}], "http_etag": + "\"18c62ebe7bdc4e1f14e968297d0a8c8e1cfd05a8\"", "start": 0, "total_size": + 3}'} + headers: + content-length: ['827'] + 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/2607 + 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/2608 + 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/2609 + 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/ListMembersOptionsTest.test_page_not_accessible_for_unprivileged_users.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_not_accessible_for_unprivileged_users.yaml new file mode 100644 index 0000000..77de007 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_not_accessible_for_unprivileged_users.yaml @@ -0,0 +1,315 @@ +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=foo%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/foo.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/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: list_id=foo.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/4589'] + status: {code: 201, message: Created} +- request: + body: list_id=foo.example.com&role=moderator&subscriber=moderator%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/4590'] + status: {code: 201, message: Created} +- 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/2612'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2612 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"708ef604f84d384f1d7cfbc229926f3173eff543\"", "is_server_owner": false, + "password": "$6$rounds=607783$i14H5eib631hoRwN$38xYdx4aYhBal.qrN2nQbPBKnffLTJb/4X7nRlodE.lAvDpNEQnNNRITnXPNlkLl2eL70l5COpf5vAghG5Td6/", + "self_link": "http://localhost:9001/3.0/users/2612", "user_id": 2612}'} + 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/2612/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"f400325071fe0a882cb73dbbe4240164312a1756\"", "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/2612"}], "http_etag": "\"93d9fb86dbb975810fc1c33e7b3aca06e5099575\"", + "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 '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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=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/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/4591'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"708ef604f84d384f1d7cfbc229926f3173eff543\"", "is_server_owner": false, + "password": "$6$rounds=607783$i14H5eib631hoRwN$38xYdx4aYhBal.qrN2nQbPBKnffLTJb/4X7nRlodE.lAvDpNEQnNNRITnXPNlkLl2eL70l5COpf5vAghG5Td6/", + "self_link": "http://localhost:9001/3.0/users/2612", "user_id": 2612}'} + 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/2612/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"22b7bbefdd8e6300f55edbaad06f45d889a35c4d\"", "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/2612", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"4c3e0e9c4b80a7fa8d66cc9922ccf8dacaaa0702\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + 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": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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": "\"4d30cbf1f859cb5a83da2d77f49d8fb50f5f7420\"", + "list_id": "foo.example.com", "member_id": 4589, "moderation_action": "accept", + "role": "owner", "self_link": "http://localhost:9001/3.0/members/4589", "user": + "http://localhost:9001/3.0/users/2610"}], "http_etag": "\"88557a24364b6c9e172714fc9a0ef51d54ef17da\"", + "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": + "\"b6ee7365a660001ef272004ae1248f94dc9c7523\"", "list_id": "foo.example.com", + "member_id": 4590, "moderation_action": "accept", "role": "moderator", "self_link": + "http://localhost:9001/3.0/members/4590", "user": "http://localhost:9001/3.0/users/2611"}], + "http_etag": "\"7fc0479dfcfa9296f6ef6faf17bb6467d0f14d3c\"", "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/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": "\"59837947ccfaf5c271f4d5fb21e7c1cf011b272f\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2610", "user_id": 2610}, + {"created_on": "2005-08-01T07:49:23", "http_etag": "\"d7c50d476e69848f5433854c54088aa32074a18d\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2611", + "user_id": 2611}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"708ef604f84d384f1d7cfbc229926f3173eff543\"", + "is_server_owner": false, "password": "$6$rounds=607783$i14H5eib631hoRwN$38xYdx4aYhBal.qrN2nQbPBKnffLTJb/4X7nRlodE.lAvDpNEQnNNRITnXPNlkLl2eL70l5COpf5vAghG5Td6/", + "self_link": "http://localhost:9001/3.0/users/2612", "user_id": 2612}], "http_etag": + "\"f8d6e982ff405062fbb2bdebb1999af0e8293834\"", "start": 0, "total_size": + 3}'} + headers: + content-length: ['827'] + 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/2610 + 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/2611 + 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/2612 + 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/ListMembersOptionsTest.test_page_not_accessible_if_not_logged_in.yaml b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_not_accessible_if_not_logged_in.yaml new file mode 100644 index 0000000..cc175bd --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/ListMembersOptionsTest.test_page_not_accessible_if_not_logged_in.yaml @@ -0,0 +1,233 @@ +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=foo%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/foo.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/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: list_id=foo.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/4592'] + status: {code: 201, message: Created} +- request: + body: list_id=foo.example.com&role=moderator&subscriber=moderator%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/4593'] + status: {code: 201, message: Created} +- 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/2615'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/2615 + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"6391e4d99c1ed86c7e2038b737a4a08b4dbcf1af\"", "is_server_owner": false, + "password": "$6$rounds=646278$a6o1VjW.zq/0gyLy$oNuHrAQqj2jmKAJ.idVUKzKKWHxTQO6.HnyZHPeX4gJZlvwTBtGEgdY9A8ximHM1k/pECprdI2CiDL3WXGcbI0", + "self_link": "http://localhost:9001/3.0/users/2615", "user_id": 2615}'} + 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/2615/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "test@example.com", "http_etag": + "\"0d0873ed918c580fea38c274cc97df68b013ca79\"", "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/2615"}], "http_etag": "\"7f2f3ef161bf541697fa1f2e29d450f799e73691\"", + "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 '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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=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/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/4594'] + status: {code: 201, message: Created} +- 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": "\"02338048f13405069664dd64cca65ab8266c3297\"", "is_server_owner": + false, "self_link": "http://localhost:9001/3.0/users/2613", "user_id": 2613}, + {"created_on": "2005-08-01T07:49:23", "http_etag": "\"7d0624c8804cefe27f10c0a6e163b01035403fed\"", + "is_server_owner": false, "self_link": "http://localhost:9001/3.0/users/2614", + "user_id": 2614}, {"created_on": "2005-08-01T07:49:23", "http_etag": "\"6391e4d99c1ed86c7e2038b737a4a08b4dbcf1af\"", + "is_server_owner": false, "password": "$6$rounds=646278$a6o1VjW.zq/0gyLy$oNuHrAQqj2jmKAJ.idVUKzKKWHxTQO6.HnyZHPeX4gJZlvwTBtGEgdY9A8ximHM1k/pECprdI2CiDL3WXGcbI0", + "self_link": "http://localhost:9001/3.0/users/2615", "user_id": 2615}], "http_etag": + "\"7b1da78e2a459106585efb95a3c957e8ea8e7421\"", "start": 0, "total_size": + 3}'} + headers: + content-length: ['827'] + 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/2613 + 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/2614 + 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/2615 + 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/MailmanUserTest.test_presence_of_form_in_user_global_settings.yaml b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_global_settings.yaml new file mode 100644 index 0000000..86259f7 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_global_settings.yaml @@ -0,0 +1,201 @@ +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=foo%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/foo.example.com'] + status: {code: 201, message: Created} +- request: + body: email=user%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/2621'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"b7a850acd310d62e9e603a618f30b1e40f256606\"", "is_server_owner": false, + "password": "$6$rounds=681028$XHeL.4KvaJFxIFJU$xEXFeosUxSAwyHUqIoXmShKEhMuhucO5ZivjtMO.ZdqjWjYtaTtCzCkf0xW5MIJ38INR.gmszsfKtvYQjGW1c.", + "self_link": "http://localhost:9001/3.0/users/2621", "user_id": 2621}'} + 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/2621/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"947d8347885b3d4a30b1d7e550aa0de8b58c4fbd\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2621"}], "http_etag": "\"ea201a77c0b60223ff4e3fa9fa45df3281a4cf75\"", + "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/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"b7a850acd310d62e9e603a618f30b1e40f256606\"", "is_server_owner": false, + "password": "$6$rounds=681028$XHeL.4KvaJFxIFJU$xEXFeosUxSAwyHUqIoXmShKEhMuhucO5ZivjtMO.ZdqjWjYtaTtCzCkf0xW5MIJ38INR.gmszsfKtvYQjGW1c.", + "self_link": "http://localhost:9001/3.0/users/2621", "user_id": 2621}'} + 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/2621/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"947d8347885b3d4a30b1d7e550aa0de8b58c4fbd\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2621"}], "http_etag": "\"ea201a77c0b60223ff4e3fa9fa45df3281a4cf75\"", + "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/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"b7a850acd310d62e9e603a618f30b1e40f256606\"", "is_server_owner": false, + "password": "$6$rounds=681028$XHeL.4KvaJFxIFJU$xEXFeosUxSAwyHUqIoXmShKEhMuhucO5ZivjtMO.ZdqjWjYtaTtCzCkf0xW5MIJ38INR.gmszsfKtvYQjGW1c.", + "self_link": "http://localhost:9001/3.0/users/2621", "user_id": 2621}'} + 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/2621/preferences + response: + body: {string: !!python/unicode '{"http_etag": "\"2db584a9a1c66e633ca0c11c813f1a72a26999cb\"", + "self_link": "http://localhost:9001/3.0/users/2621/preferences"}'} + headers: + content-length: ['126'] + 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": "\"b7a850acd310d62e9e603a618f30b1e40f256606\"", "is_server_owner": + false, "password": "$6$rounds=681028$XHeL.4KvaJFxIFJU$xEXFeosUxSAwyHUqIoXmShKEhMuhucO5ZivjtMO.ZdqjWjYtaTtCzCkf0xW5MIJ38INR.gmszsfKtvYQjGW1c.", + "self_link": "http://localhost:9001/3.0/users/2621", "user_id": 2621}], "http_etag": + "\"6697ff9065ffa70c4cee3d57515adcd5604dcf42\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['435'] + 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/2621 + 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/MailmanUserTest.test_presence_of_form_in_user_list_options.yaml b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_list_options.yaml new file mode 100644 index 0000000..cb573fd --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_list_options.yaml @@ -0,0 +1,249 @@ +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=foo%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/foo.example.com'] + status: {code: 201, message: Created} +- request: + body: email=user%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/2622'] + status: {code: 201, message: Created} +- 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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=user%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/4597'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"ad800a1b557c942a74002421352ad637ef54361d\"", "is_server_owner": false, + "password": "$6$rounds=668522$Zz437QzE97T.VyQt$2uk3VYKY.4pMLNS1JhszPNREjjBMLU8kPbjsQkabxEdpXsMx430oO4gffBs2jTCnjrK4UmeHkWGJqyomXyR3e0", + "self_link": "http://localhost:9001/3.0/users/2622", "user_id": 2622}'} + 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/2622/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"aae2dc671b053efd6f2a35396be2e1d0b6cf5a49\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2622", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"a7855ef58c95002a41df1bebfd6e00938f31add5\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + 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": "\"98cc998d4a30293ec17da639bce10617912a6e1e\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 1, "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/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"ad800a1b557c942a74002421352ad637ef54361d\"", "is_server_owner": false, + "password": "$6$rounds=668522$Zz437QzE97T.VyQt$2uk3VYKY.4pMLNS1JhszPNREjjBMLU8kPbjsQkabxEdpXsMx430oO4gffBs2jTCnjrK4UmeHkWGJqyomXyR3e0", + "self_link": "http://localhost:9001/3.0/users/2622", "user_id": 2622}'} + 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/2622/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"aae2dc671b053efd6f2a35396be2e1d0b6cf5a49\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2622", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"a7855ef58c95002a41df1bebfd6e00938f31add5\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: subscriber=user%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/find + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/user@example.com", + "delivery_mode": "regular", "email": "user@example.com", "http_etag": "\"e851b50bc753c29b8dc7c780b9ddf936fd8d691d\"", + "list_id": "foo.example.com", "member_id": 4597, "moderation_action": "defer", + "role": "member", "self_link": "http://localhost:9001/3.0/members/4597", "user": + "http://localhost:9001/3.0/users/2622"}], "http_etag": "\"0af9a069478e96700f8edf174e01eeb73ce00f78\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['490'] + 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/members/4597/preferences + response: + body: {string: !!python/unicode '{"http_etag": "\"fa5eef4cab3cebc46090e039de496e19eb825609\"", + "self_link": "http://localhost:9001/3.0/members/4597/preferences"}'} + headers: + content-length: ['128'] + 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": "\"ad800a1b557c942a74002421352ad637ef54361d\"", "is_server_owner": + false, "password": "$6$rounds=668522$Zz437QzE97T.VyQt$2uk3VYKY.4pMLNS1JhszPNREjjBMLU8kPbjsQkabxEdpXsMx430oO4gffBs2jTCnjrK4UmeHkWGJqyomXyR3e0", + "self_link": "http://localhost:9001/3.0/users/2622", "user_id": 2622}], "http_etag": + "\"ba378435678523b8994e039fb8204ebd930d7851\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['435'] + 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/2622 + 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/MailmanUserTest.test_presence_of_form_in_user_subscription_preferences.yaml b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_subscription_preferences.yaml new file mode 100644 index 0000000..d14f254 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/MailmanUserTest.test_presence_of_form_in_user_subscription_preferences.yaml @@ -0,0 +1,251 @@ +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=foo%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/foo.example.com'] + status: {code: 201, message: Created} +- request: + body: email=user%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/2623'] + status: {code: 201, message: Created} +- 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: display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=user%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/4598'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"4fa1bb835cc391709a2d6676a4e58cfad0c544f3\"", "is_server_owner": false, + "password": "$6$rounds=603749$AeC1fWkD.7I/S1eD$EyYSUN6bka5vVksWqsYekgIe6K36ZTxv9sWzS8zEU.vEsP0/XKlChd5dtyu8TKMdU9.BwzJfOiJwCa03WvE6p.", + "self_link": "http://localhost:9001/3.0/users/2623", "user_id": 2623}'} + 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/2623/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"e89a8e796d0dd2a63a852851fba793d4651f5b65\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2623", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"f3d1f02cccdb607395371f187704957e6a069da7\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + 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/user@example.com + response: + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"4fa1bb835cc391709a2d6676a4e58cfad0c544f3\"", "is_server_owner": false, + "password": "$6$rounds=603749$AeC1fWkD.7I/S1eD$EyYSUN6bka5vVksWqsYekgIe6K36ZTxv9sWzS8zEU.vEsP0/XKlChd5dtyu8TKMdU9.BwzJfOiJwCa03WvE6p.", + "self_link": "http://localhost:9001/3.0/users/2623", "user_id": 2623}'} + 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/2623/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"e89a8e796d0dd2a63a852851fba793d4651f5b65\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2623", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"f3d1f02cccdb607395371f187704957e6a069da7\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + 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/2623/addresses + response: + body: {string: !!python/unicode '{"entries": [{"email": "user@example.com", "http_etag": + "\"e89a8e796d0dd2a63a852851fba793d4651f5b65\"", "original_email": "user@example.com", + "registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/user@example.com", + "user": "http://localhost:9001/3.0/users/2623", "verified_on": "2005-08-01T07:49:23"}], + "http_etag": "\"f3d1f02cccdb607395371f187704957e6a069da7\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['428'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: subscriber=user%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/find + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/user@example.com", + "delivery_mode": "regular", "email": "user@example.com", "http_etag": "\"3efe9fa8c8ee80b12ab24eddc909b5ded4388872\"", + "list_id": "foo.example.com", "member_id": 4598, "moderation_action": "defer", + "role": "member", "self_link": "http://localhost:9001/3.0/members/4598", "user": + "http://localhost:9001/3.0/users/2623"}], "http_etag": "\"aa52ba493ad14089169d4feb6a04dfbaaf7a2579\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['490'] + 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/members/4598/preferences + response: + body: {string: !!python/unicode '{"http_etag": "\"77bd926020df755765714a2e5812c6ddeadb8ed4\"", + "self_link": "http://localhost:9001/3.0/members/4598/preferences"}'} + headers: + content-length: ['128'] + 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": "\"4fa1bb835cc391709a2d6676a4e58cfad0c544f3\"", "is_server_owner": + false, "password": "$6$rounds=603749$AeC1fWkD.7I/S1eD$EyYSUN6bka5vVksWqsYekgIe6K36ZTxv9sWzS8zEU.vEsP0/XKlChd5dtyu8TKMdU9.BwzJfOiJwCa03WvE6p.", + "self_link": "http://localhost:9001/3.0/users/2623", "user_id": 2623}], "http_etag": + "\"365468462e937cd4cb449747fc48fbf878c1cd91\"", "start": 0, "total_size": + 1}'} + headers: + content-length: ['435'] + 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/2623 + 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_domain_new.py b/src/postorius/tests/mailman_api_tests/test_domain_new.py index 7ae861e..5cb975e 100644 --- a/src/postorius/tests/mailman_api_tests/test_domain_new.py +++ b/src/postorius/tests/mailman_api_tests/test_domain_new.py @@ -41,10 +41,9 @@ post_data = {'mail_host': 'example.com', 'web_host': 'http://example.com', 'description': 'A new Domain.'} - response = self.client.post(reverse('domain_new'), post_data, - follow=True) + response = self.client.post(reverse('domain_new'), post_data) - self.assertContains(response, 'New Domain registered') + self.assertHasSuccessMessage(response) self.assertRedirects(response, reverse('domain_index')) a_new_domain = self.mm_client.get_domain('example.com') @@ -53,3 +52,14 @@ self.assertEqual(a_new_domain.owners[0]['user_id'], self.mm_client.get_user('su@example.com').user_id) a_new_domain.delete() + + def test_validation_of_mail_host(self): + self.client.login(username='su', password='pwd') + post_data = {'mail_host': 'example com', + 'web_host': 'http://example.com', + 'description': 'A new Domain'} + response = self.client.post(reverse('domain_new'), post_data) + self.assertContains(response, 'Please check the errors below') + self.assertContains(response, 'Please enter a valid domain name') + # self.assertHasErrorMessage(response) + self.assertEquals(response.status_code, 200) diff --git a/src/postorius/tests/mailman_api_tests/test_list_member_options.py b/src/postorius/tests/mailman_api_tests/test_list_member_options.py new file mode 100644 index 0000000..f5c84b6 --- /dev/null +++ b/src/postorius/tests/mailman_api_tests/test_list_member_options.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2012-2015 by the Free Software Foundation, Inc. +# +# This file is part of Postorius. +# +# Postorius is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# Postorius is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Postorius. If not, see . +from __future__ import absolute_import, print_function, unicode_literals + +from django.conf import settings +from django.contrib.auth.models import User +from django.core.urlresolvers import reverse +from six.moves.urllib_parse import quote + +from postorius.tests.utils import ViewTestCase +from postorius.utils import get_client +from postorius.forms import MemberModeration, UserPreferences + + +class ListMembersOptionsTest(ViewTestCase): + """Tests for the list members page. + + Tests permissions and creation of list owners and moderators. + """ + + def setUp(self): + super(ListMembersOptionsTest, self).setUp() + self.domain = get_client().create_domain('example.com') + self.foo_list = self.domain.create_list('foo') + self.user = User.objects.create_user( + 'testuser', 'test@example.com', 'testpass') + self.superuser = User.objects.create_superuser( + 'testsu', 'su@example.com', 'testpass') + self.owner = User.objects.create_user( + 'testowner', 'owner@example.com', 'testpass') + self.moderator = User.objects.create_user( + 'testmoderator', 'moderator@example.com', 'testpass') + self.foo_list.add_owner('owner@example.com') + self.foo_list.add_moderator('moderator@example.com') + self.mm_user = get_client().create_user('test@example.com', '') + self.mm_user.addresses[0].verify() + self.foo_list.subscribe('test@example.com', pre_verified=True, + pre_confirmed=True, pre_approved=True) + self.url = reverse('list_member_options', args=(self.foo_list.list_id, + 'test@example.com',)) + self.url = quote(self.url) + + def test_page_not_accessible_if_not_logged_in(self): + response = self.client.get(self.url) + self.assertRedirects(response, '{}?next={}'.format( + reverse(settings.LOGIN_URL), self.url)) + + def test_page_not_accessible_for_unprivileged_users(self): + self.client.login(username='testuser', password='testpass') + response = self.client.get(self.url) + self.assertEqual(response.status_code, 403) + + def test_not_accessible_for_moderator(self): + self.client.login(username='testmoderator', password='testpass') + response = self.client.get(self.url) + self.assertEqual(response.status_code, 403) + + def test_page_accessible_for_superuser(self): + self.client.login(username='testsu', password='testpass') + response = self.client.get(self.url) + self.assertEqual(response.status_code, 200) + self.assertIsInstance(response.context['moderation_form'], + MemberModeration) + self.assertIsInstance(response.context['preferences_form'], + UserPreferences) + + def test_page_accessible_for_owner(self): + self.client.login(username='testowner', password='testpass') + response = self.client.get(self.url) + self.assertEqual(response.status_code, 200) + self.assertIsInstance(response.context['moderation_form'], + MemberModeration) + self.assertIsInstance(response.context['preferences_form'], + UserPreferences) diff --git a/src/postorius/tests/mailman_api_tests/test_list_new.py b/src/postorius/tests/mailman_api_tests/test_list_new.py index cb3bae5..1a4420b 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_new.py +++ b/src/postorius/tests/mailman_api_tests/test_list_new.py @@ -44,7 +44,20 @@ 'list_owner': 'owner@example.com', 'advertised': 'True', 'description': 'A new list.'} - self.client.post(reverse('list_new'), post_data) + response = self.client.post(reverse('list_new'), post_data) + self.assertHasSuccessMessage(response) a_new_list = self.mm_client.get_list('a_new_list@example.com') self.assertEqual(a_new_list.fqdn_listname, u'a_new_list@example.com') self.assertEqual(a_new_list.owners, [u'owner@example.com']) + + def test_listname_validation(self): + self.client.login(username='su', password='pwd') + post_data = {'listname': 'a new list', + 'mail_host': 'example.com', + 'list_owner': 'owner@example.com', + 'advertised': 'True', + 'description': 'A new list.'} + response = self.client.post(reverse('list_new'), post_data) + self.assertEquals(response.status_code, 200) + # self.assertHasErrorMessage(response) + self.assertContains(response, 'Please enter a valid listname') diff --git a/src/postorius/tests/mailman_api_tests/test_user.py b/src/postorius/tests/mailman_api_tests/test_user.py index e28b3f7..1fbe8da 100644 --- a/src/postorius/tests/mailman_api_tests/test_user.py +++ b/src/postorius/tests/mailman_api_tests/test_user.py @@ -24,6 +24,7 @@ from postorius.models import MailmanUser, Mailman404Error from postorius.tests.utils import ViewTestCase +from postorius.forms import UserPreferences, ChangeSubscriptionForm class MailmanUserTest(ViewTestCase): @@ -118,3 +119,31 @@ self.assertEqual(response.status_code, 200) # The Mailman user must have been created self.assertIsNotNone(MailmanUser.objects.get(address=user.email)) + + def test_presence_of_form_in_user_global_settings(self): + self.client.login(username='user', password='testpass') + response = self.client.get(reverse('user_mailmansettings')) + self.assertEquals(response.status_code, 200) + self.assertIsInstance(response.context['settingsform'], + UserPreferences) + + def test_presence_of_form_in_user_subscription_preferences(self): + self.client.login(username='user', password='testpass') + self.foo_list.subscribe(self.user.email, pre_verified=True, + pre_confirmed=True, pre_approved=True) + response = self.client.get(reverse('user_subscription_preferences')) + self.assertEquals(response.status_code, 200) + self.assertIsNotNone(response.context['zipped_data']) + self.assertEquals(len(response.context['zipped_data']), 1) + + def test_presence_of_form_in_user_list_options(self): + self.client.login(username='user', password='testpass') + self.foo_list.subscribe(self.user.email, pre_verified=True, + pre_confirmed=True, pre_approved=True) + response = self.client.get(reverse('user_list_options', + args=[self.foo_list.list_id])) + self.assertEquals(response.status_code, 200) + self.assertIsInstance(response.context['form'], + UserPreferences) + self.assertIsInstance(response.context['change_subscription_form'], + ChangeSubscriptionForm) diff --git a/src/postorius/tests/test_domain_view.py b/src/postorius/tests/test_domain_view.py new file mode 100644 index 0000000..8009925 --- /dev/null +++ b/src/postorius/tests/test_domain_view.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2012-2016 by the Free Software Foundation, Inc. +# +# This file is part of Postorius. +# +# Postorius is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# Postorius is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Postorius. If not, see . +from django.test import TestCase +from django.core.urlresolvers import reverse +from django.contrib.auth.models import User +from postorius.forms import DomainNew + + +class DomainViewTest(TestCase): + + def setUp(self): + self.user = User.objects.create_superuser('su', 'su@example.com', + 'pass') + + def tearDown(self): + self.user.delete() + + def test_form_is_rendered(self): + self.client.login(username='su', password='pass') + response = self.client.get(reverse('domain_new'), follow=True) + self.assertEquals(response.status_code, 200) + self.assertIsInstance(response.context['form'], DomainNew) diff --git a/src/postorius/views/domain.py b/src/postorius/views/domain.py index b991fe2..ef6f9f3 100644 --- a/src/postorius/views/domain.py +++ b/src/postorius/views/domain.py @@ -19,7 +19,6 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required, user_passes_test -from django.core.urlresolvers import reverse from django.shortcuts import render, redirect from django.utils.translation import gettext as _ try: @@ -45,7 +44,6 @@ @login_required @user_passes_test(lambda u: u.is_superuser) def domain_new(request): - message = None if request.method == 'POST': form = DomainNew(request.POST) if form.is_valid(): @@ -62,10 +60,11 @@ else: messages.success(request, _("New Domain registered")) return redirect("domain_index") + else: + messages.error(request, _('Please check the errors below')) else: form = DomainNew() - return render(request, 'postorius/domain/new.html', - {'form': form, 'message': message}) + return render(request, 'postorius/domain/new.html', {'form': form}) @login_required @@ -84,6 +83,5 @@ messages.error(request, _('The domain could not be deleted: %s' % e.msg)) return redirect("domain_index") - submit_url = reverse('domain_delete', kwargs={'domain': domain}) return render(request, 'postorius/domain/confirm_delete.html', - {'domain': domain, 'submit_url': submit_url}) + {'domain': domain}) diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 20a6473..c5a64be 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -96,13 +96,14 @@ query = context['query'] = request.GET['q'] if "*" not in query: query = '*{}*'.format(query) + # Proxy the find_members method to insert the query - method = lambda count, page: mailing_list.find_members( - query, count=count, page=page) + def find_method(count, page): + return mailing_list.find_members(query, count=count, page=page) else: - method = mailing_list.get_member_page + find_method = mailing_list.get_member_page context['members'] = utils.paginate( - request, method, count=request.GET.get('count', 25), + request, find_method, count=request.GET.get('count', 25), paginator_class=utils.MailmanPaginator) if len(mailing_list.members) == 0: context['empty_error'] = _('List has no Subscribers') @@ -518,6 +519,8 @@ except HTTPError as e: return render(request, 'postorius/errors/generic.html', {'error': e}) + else: + messages.error(request, _('Please check the errors below')) else: form = ListNew(choosable_domains, initial={'list_owner': request.user.email}) diff --git a/tox.ini b/tox.ini index e699b28..71025d1 100644 --- a/tox.ini +++ b/tox.ini @@ -71,6 +71,6 @@ flake8 {posargs} [flake8] -ignore = E123, E133, E731 +ignore = E123, E133 show-source = True exclude = .git,.tox,dist,*egg,testing,src/postorius/doc