diff --git a/src/postorius/auth/decorators.py b/src/postorius/auth/decorators.py index 1b4ea88..7fc369b 100644 --- a/src/postorius/auth/decorators.py +++ b/src/postorius/auth/decorators.py @@ -23,6 +23,7 @@ from postorius.models import (Domain, List, Member, MailmanUser, MailmanApiError, Mailman404Error) +from postorius.utils import user_is_in_list_roster def basic_auth_login(fn): @@ -56,14 +57,13 @@ raise PermissionDenied if user.is_superuser: return fn(*args, **kwargs) - if getattr(user, 'is_list_owner', None): + if not hasattr(user, 'is_list_owner'): + mlist = List.objects.get_or_404(fqdn_listname=list_id) + user.is_list_owner = user_is_in_list_roster(user, mlist, "owners") + if user.is_list_owner: return fn(*args, **kwargs) - mlist = List.objects.get_or_404(fqdn_listname=list_id) - if user.email not in mlist.owners: - raise PermissionDenied else: - user.is_list_owner = True - return fn(*args, **kwargs) + raise PermissionDenied return wrapper @@ -79,22 +79,19 @@ raise PermissionDenied if user.is_superuser: return fn(*args, **kwargs) - if getattr(user, 'is_list_owner', None): + if (not hasattr(user, 'is_list_owner') + or not hasattr(user, 'is_list_moderator')): + mlist = List.objects.get_or_404(fqdn_listname=list_id) + if not hasattr(user, 'is_list_owner'): + user.is_list_owner = user_is_in_list_roster( + user, mlist, "owners") + if not hasattr(user, 'is_list_moderator'): + user.is_list_moderator = user_is_in_list_roster( + user, mlist, "moderators") + if user.is_list_owner or user.is_list_moderator: return fn(*args, **kwargs) - if getattr(user, 'is_list_moderator', None): - return fn(*args, **kwargs) - mlist = List.objects.get_or_404(fqdn_listname=list_id) - if user.email not in mlist.moderators and \ - user.email not in mlist.owners: - raise PermissionDenied else: - if user.email in mlist.moderators and \ - user.email not in mlist.owners: - user.is_list_moderator = True - else: - user.is_list_moderator = True - user.is_list_owner = True - return fn(*args, **kwargs) + raise PermissionDenied return wrapper diff --git a/src/postorius/templates/postorius/user_profile.html b/src/postorius/templates/postorius/user_profile.html index 48bbd12..1a0972f 100644 --- a/src/postorius/templates/postorius/user_profile.html +++ b/src/postorius/templates/postorius/user_profile.html @@ -11,15 +11,27 @@

{% trans "User Profile" %} - {{ user }}

- - - - - - - - - - + + + + + + + + + + + + + + + + + +
{% trans 'Mailman display name' %}{{ mm_user.display_name}}
{% trans 'User name' %}{{ user.username}}
{% trans 'Mailman display name' %}{{ mm_user.display_name}}
{% trans 'User name' %}{{ user.username}}
{% trans 'Main email' %}{{ user.email}}
{% trans 'Other emails' %}
    + {% for email in user.other_emails %} +
  • {{ email }}
  • + {% endfor %} +
{% endblock main %} diff --git a/src/postorius/tests/fixtures/vcr_cassettes/list_members_access.yaml b/src/postorius/tests/fixtures/vcr_cassettes/list_members_access.yaml index 803aba2..f1ed5e2 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/list_members_access.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/list_members_access.yaml @@ -579,6 +579,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:15 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"entries": [{"self_link": "http://localhost:9001/3.0/members/159620023615929456754306653256797611603", @@ -589,7 +605,7 @@ "regular", "email": "owner@example.com"}], "http_etag": "\"b9d5581015ee3a6a62d5a44b9f50829408a7301c\"", "total_size": 1, "start": 0}'} headers: - content-length: ['565'] + content-length: ['564'] content-type: [application/json; charset=utf-8] date: ['Wed, 11 Nov 2015 12:49:31 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] @@ -652,7 +668,7 @@ "regular", "email": "owner@example.com"}], "http_etag": "\"b9d5581015ee3a6a62d5a44b9f50829408a7301c\"", "total_size": 1, "start": 0}'} headers: - content-length: ['565'] + content-length: ['564'] content-type: [application/json; charset=utf-8] date: ['Wed, 11 Nov 2015 12:49:32 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] diff --git a/src/postorius/tests/fixtures/vcr_cassettes/list_members_page.yaml b/src/postorius/tests/fixtures/vcr_cassettes/list_members_page.yaml index c590bd8..6089760 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/list_members_page.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/list_members_page.yaml @@ -42,19 +42,98 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/moderator@example.com + response: + body: {string: !!python/unicode '{"http_etag": "\"eb9cd59b8fb9ea633982ab974670ec1be0402607\"", + "self_link": "http://localhost:9001/3.0/users/94704940159445895320083756410847799181", + "is_server_owner": false, "user_id": 94704940159445895320083756410847799181, + "created_on": "2015-11-11T08:52:08.898514"}'} + headers: + content-length: ['269'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:09 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/94704940159445895320083756410847799181 + response: + body: {string: !!python/unicode '{"http_etag": "\"eb9cd59b8fb9ea633982ab974670ec1be0402607\"", + "self_link": "http://localhost:9001/3.0/users/94704940159445895320083756410847799181", + "is_server_owner": false, "user_id": 94704940159445895320083756410847799181, + "created_on": "2015-11-11T08:52:08.898514"}'} + headers: + content-length: ['269'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:09 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/94704940159445895320083756410847799181/addresses + response: + body: {string: !!python/unicode '{"total_size": 1, "entries": [{"original_email": + "moderator@example.com", "user": "http://localhost:9001/3.0/users/94704940159445895320083756410847799181", + "http_etag": "\"9a96cbe5ba5df8c76cb87cbc948d261d02565192\"", "self_link": + "http://localhost:9001/3.0/addresses/moderator@example.com", "registered_on": + "2015-11-11T08:52:08.869116", "email": "moderator@example.com"}], "http_etag": + "\"a86a44aaf86663deff50f2972891636e82db9ecd\"", "start": 0}'} + headers: + content-length: ['446'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:09 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/moderator@example.com + response: + body: {string: !!python/unicode '{"original_email": "moderator@example.com", "user": + "http://localhost:9001/3.0/users/94704940159445895320083756410847799181", + "http_etag": "\"9a96cbe5ba5df8c76cb87cbc948d261d02565192\"", "self_link": + "http://localhost:9001/3.0/addresses/moderator@example.com", "registered_on": + "2015-11-11T08:52:08.869116", "email": "moderator@example.com"}'} + headers: + content-length: ['341'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:09 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: - body: {string: !!python/unicode '{"entries": [{"self_link": "http://localhost:9001/3.0/members/261891266690910004584167411574025850636", + body: {string: !!python/unicode '{"total_size": 1, "entries": [{"member_id": 261891266690910004584167411574025850636, + "address": "http://localhost:9001/3.0/addresses/owner@example.com", "list_id": + "foo.example.com", "http_etag": "\"ce0fdcf05dd4930cee008fe8157bbf59643748a6\"", "user": "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", - "http_etag": "\"92d38feca8af044bc45d2b8f68d3e37ed4431cc8\"", "list_id": "foo.example.com", - "address": "http://localhost:9001/3.0/addresses/owner@example.com", "role": - "owner", "member_id": 261891266690910004584167411574025850636, "delivery_mode": - "regular", "email": "owner@example.com"}], "http_etag": "\"9183ae6d24ff423877969f8a2470de8d81948d92\"", - "total_size": 1, "start": 0}'} + "email": "owner@example.com", "role": "owner", "self_link": "http://localhost:9001/3.0/members/261891266690910004584167411574025850636", + "delivery_mode": "regular"}], "http_etag": "\"e1588957a20c78be1fcd3fd6235890ed1dab4e37\"", + "start": 0}'} headers: - content-length: ['565'] + content-length: ['564'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:26 GMT'] + date: ['Wed, 11 Nov 2015 08:52:09 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -148,12 +227,90 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=25&page=1 response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} headers: content-length: ['90'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:28 GMT'] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/owner@example.com + response: + body: {string: !!python/unicode '{"http_etag": "\"8592c09f671a685907e05a62a28bb0096fa9d998\"", + "self_link": "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", + "is_server_owner": false, "user_id": 94218210250211962065145319561376051884, + "created_on": "2015-11-11T08:52:08.703105"}'} + headers: + content-length: ['267'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/94218210250211962065145319561376051884 + response: + body: {string: !!python/unicode '{"http_etag": "\"8592c09f671a685907e05a62a28bb0096fa9d998\"", + "self_link": "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", + "is_server_owner": false, "user_id": 94218210250211962065145319561376051884, + "created_on": "2015-11-11T08:52:08.703105"}'} + headers: + content-length: ['267'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/94218210250211962065145319561376051884/addresses + response: + body: {string: !!python/unicode '{"total_size": 1, "entries": [{"original_email": + "owner@example.com", "user": "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", + "http_etag": "\"b5f13df8b7fd88ff94dc60ab2e400c113e630769\"", "self_link": + "http://localhost:9001/3.0/addresses/owner@example.com", "registered_on": + "2015-11-11T08:52:08.674385", "email": "owner@example.com"}], "http_etag": + "\"9e11e7259297a9dd08c71e3e984ccb5f23524673\"", "start": 0}'} + headers: + content-length: ['433'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/owner@example.com + response: + body: {string: !!python/unicode '{"original_email": "owner@example.com", "user": + "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", "http_etag": + "\"b5f13df8b7fd88ff94dc60ab2e400c113e630769\"", "self_link": "http://localhost:9001/3.0/addresses/owner@example.com", + "registered_on": "2015-11-11T08:52:08.674385", "email": "owner@example.com"}'} + headers: + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -207,6 +364,47 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"list_id": "foo.example.com", "mail_host": "example.com", + "volume": 1, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "display_name": "Foo", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "fqdn_listname": "foo@example.com", "member_count": 0, "list_name": "foo"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"total_size": 1, "entries": [{"member_id": 243692671647427957757469737170312906392, + "address": "http://localhost:9001/3.0/addresses/owner@example.com", "list_id": + "foo.example.com", "http_etag": "\"b2ed02fece44ad60e9b7c12ff65a29c8f38c1d6c\"", + "user": "http://localhost:9001/3.0/users/94218210250211962065145319561376051884", + "email": "owner@example.com", "role": "owner", "self_link": "http://localhost:9001/3.0/members/243692671647427957757469737170312906392", + "delivery_mode": "regular"}], "http_etag": "\"e51be9822b60b0bd96ccbfd420bd8ab90a0474f3\"", + "start": 0}'} + headers: + content-length: ['564'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:10 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"entries": [{"self_link": "http://localhost:9001/3.0/members/243692671647427957757469737170312906392", @@ -287,6 +485,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] 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] + date: ['Wed, 11 Nov 2015 08:52:12 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"entries": [{"self_link": "http://localhost:9001/3.0/members/15130748568807809724288298666046815183", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription-2.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription-2.yaml index 98c9183..b9149ba 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription-2.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription-2.yaml @@ -78,6 +78,21 @@ accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com/verify + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo@example.com response: @@ -98,50 +113,15 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/test@example.com response: - body: {string: !!python/unicode '{"http_etag": "\"37b41a08d3ada12388d91b9b9bc153f05b3ff730\"", - "is_server_owner": false, "user_id": 175101733981884185786040725666736952966, - "display_name": "None", "self_link": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", - "created_on": "2015-11-11T12:49:46.231219"}'} + body: {string: !!python/unicode '{"is_server_owner": false, "http_etag": "\"46c89e4c192af91458b3bc8ca8efd3199d39672e\"", + "user_id": 175101733981884185786040725666736952966, "self_link": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", + "display_name": "None", "created_on": "2015-11-11T08:52:29.896503"}'} headers: content-length: ['295'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -153,14 +133,13 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/175101733981884185786040725666736952966 response: - body: {string: !!python/unicode '{"http_etag": "\"37b41a08d3ada12388d91b9b9bc153f05b3ff730\"", - "is_server_owner": false, "user_id": 175101733981884185786040725666736952966, - "display_name": "None", "self_link": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", - "created_on": "2015-11-11T12:49:46.231219"}'} + body: {string: !!python/unicode '{"is_server_owner": false, "http_etag": "\"46c89e4c192af91458b3bc8ca8efd3199d39672e\"", + "user_id": 175101733981884185786040725666736952966, "self_link": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", + "display_name": "None", "created_on": "2015-11-11T08:52:29.896503"}'} headers: content-length: ['295'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -172,21 +151,21 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/175101733981884185786040725666736952966/addresses response: - body: {string: !!python/unicode '{"entries": [{"email": "anotheremail@example.com", + body: {string: !!python/unicode '{"total_size": 2, "entries": [{"verified_on": + "2015-11-11T08:52:30.262179", "original_email": "anotheremail@example.com", "user": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", - "http_etag": "\"f426bc970d106dbe0b97a94d2a1cb7d4841c7426\"", "self_link": + "http_etag": "\"81c4cd219f97c86934e5fcdb7804c920e891bcc8\"", "self_link": "http://localhost:9001/3.0/addresses/anotheremail@example.com", "registered_on": - "2015-11-11T12:49:46.474206", "original_email": "anotheremail@example.com"}, - {"email": "test@example.com", "user": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", - "display_name": "None", "http_etag": "\"ff99ece0c664fbdc7c31e598be6fff735098d6e8\"", - "self_link": "http://localhost:9001/3.0/addresses/test@example.com", "registered_on": - "2015-11-11T12:49:46.213354", "original_email": "test@example.com"}], "http_etag": - "\"f2c8e9b9e18b8429f7f55962f7ec73bd670fb7f4\"", "total_size": 2, "start": - 0}'} + "2015-11-11T08:52:30.155031", "email": "anotheremail@example.com"}, {"original_email": + "test@example.com", "user": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", + "http_etag": "\"dbf31067cb3a34f66b4b7e99d58e8e714923dcba\"", "registered_on": + "2015-11-11T08:52:29.878035", "self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "display_name": "None", "email": "test@example.com"}], "http_etag": "\"6cd8190baf5403ef8476c864d712db23cafc3bd2\"", + "start": 0}'} headers: - content-length: ['809'] + content-length: ['854'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -196,15 +175,73 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/member/anotheremail@example.com + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com response: - body: {string: !!python/unicode '{}'} + body: {string: !!python/unicode '{"verified_on": "2015-11-11T08:52:30.262179", + "original_email": "anotheremail@example.com", "user": "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", + "http_etag": "\"81c4cd219f97c86934e5fcdb7804c920e891bcc8\"", "self_link": + "http://localhost:9001/3.0/addresses/anotheremail@example.com", "registered_on": + "2015-11-11T08:52:30.155031", "email": "anotheremail@example.com"}'} headers: - content-length: ['2'] - content-type: [application/json] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] + content-length: ['396'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 404, message: Not Found} + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"original_email": "test@example.com", "user": + "http://localhost:9001/3.0/users/175101733981884185786040725666736952966", + "http_etag": "\"dbf31067cb3a34f66b4b7e99d58e8e714923dcba\"", "registered_on": + "2015-11-11T08:52:29.878035", "self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "display_name": "None", "email": "test@example.com"}'} + headers: + content-length: ['351'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} - request: body: null headers: @@ -218,7 +255,23 @@ headers: content-length: ['2'] content-type: [application/json] - date: ['Wed, 11 Nov 2015 12:49:46 GMT'] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/anotheremail@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 08:52:30 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 404, message: Not Found} - request: diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription.yaml index 12dfe26..b4e10c9 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_change_subscription.yaml @@ -61,48 +61,13 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:40 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:40 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/users/test@example.com response: - body: {string: !!python/unicode '{"http_etag": "\"669fb9a8f3872c7848531cb1757446f1ee3ce2d7\"", - "is_server_owner": false, "user_id": 35258670270330606438959454694878423733, - "display_name": "None", "self_link": "http://localhost:9001/3.0/users/35258670270330606438959454694878423733", - "created_on": "2015-11-11T12:49:40.357464"}'} + body: {string: !!python/unicode '{"is_server_owner": false, "http_etag": "\"4e2f73e4586662ff5840f566c7b92ba8fa8f9f71\"", + "user_id": 35258670270330606438959454694878423733, "self_link": "http://localhost:9001/3.0/users/35258670270330606438959454694878423733", + "display_name": "None", "created_on": "2015-11-11T08:52:24.187222"}'} headers: - content-length: ['293'] + content-length: ['295'] content-type: [application/json; charset=utf-8] date: ['Wed, 11 Nov 2015 12:49:40 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] @@ -155,6 +120,60 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"verified_on": "2015-11-11T08:52:24.211923", + "original_email": "test@example.com", "user": "http://localhost:9001/3.0/users/35258670270330606438959454694878423733", + "http_etag": "\"36ec1132bcb053f26e9ea61326ee7d785f7c03a6\"", "registered_on": + "2015-11-11T08:52:24.168984", "self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "display_name": "None", "email": "test@example.com"}'} + headers: + content-length: ['396'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:24 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:24 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:24 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com response: body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/members/30853255152563400446883130236676839375", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_moderator.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_moderator.yaml index 07356f0..86106a7 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_moderator.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_moderator.yaml @@ -112,6 +112,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] 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] + date: ['Wed, 11 Nov 2015 08:52:06 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner.yaml index bac6bdd..01c1b29 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner.yaml @@ -112,6 +112,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] 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] + date: ['Wed, 11 Nov 2015 08:52:07 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_new_moderator_added.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_new_moderator_added.yaml index 78aa6ab..901a9b5 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_new_moderator_added.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_new_moderator_added.yaml @@ -16,7 +16,7 @@ "regular", "email": "newmod@example.com"}], "http_etag": "\"5f5ad3923b356fa84c7977f8be4b828c16e9d40a\"", "total_size": 1, "start": 0}'} headers: - content-length: ['572'] + content-length: ['569'] content-type: [application/json; charset=utf-8] date: ['Wed, 11 Nov 2015 12:49:24 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_metrics.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_metrics.yaml index 2b63f3e..18bd031 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_metrics.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_metrics.yaml @@ -96,6 +96,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] 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] + date: ['Wed, 11 Nov 2015 12:49:38 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/test.example.org/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", @@ -115,12 +131,12 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/test.example.org/roster/moderator response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} headers: content-length: ['90'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:38 GMT'] + date: ['Wed, 11 Nov 2015 08:52:22 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -132,31 +148,30 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/test@example.org/config response: - body: {string: !!python/unicode '{"autoresponse_grace_period": "90d", "autorespond_requests": - "none", "display_name": "Test", "default_member_action": "defer", "no_reply_address": - "noreply@example.org", "autorespond_postings": "none", "admin_notify_mchanges": - false, "fqdn_listname": "test@example.org", "autoresponse_postings_text": - "", "advertised": true, "description": "", "reply_goes_to_list": "no_munging", - "post_id": 1, "filter_content": false, "last_post_at": null, "next_digest_number": - 1, "autoresponse_owner_text": "", "acceptable_aliases": [], "administrivia": - true, "collapse_alternatives": true, "owner_address": "test-owner@example.org", - "welcome_message_uri": "mailman:///welcome.txt", "allow_list_posts": true, - "subscription_policy": "confirm", "list_name": "test", "admin_immed_notify": - true, "leave_address": "test-leave@example.org", "autoresponse_request_text": - "", "posting_pipeline": "default-posting-pipeline", "convert_html_to_plaintext": - false, "reply_to_address": "", "request_address": "test-request@example.org", - "join_address": "test-join@example.org", "send_welcome_message": true, "archive_policy": - "public", "volume": 1, "first_strip_reply_to": false, "default_nonmember_action": - "hold", "posting_address": "test@example.org", "http_etag": "\"844dfa3141895bd6e9e2fe0cc3ac2614f6f8104a\"", + body: {string: !!python/unicode '{"autorespond_postings": "none", "subject_prefix": + "[Test] ", "reply_to_address": "", "autoresponse_request_text": "", "volume": + 1, "display_name": "Test", "subscription_policy": "confirm", "leave_address": + "test-leave@example.org", "last_post_at": null, "convert_html_to_plaintext": + false, "posting_pipeline": "default-posting-pipeline", "admin_notify_mchanges": + false, "posting_address": "test@example.org", "post_id": 1, "reply_goes_to_list": + "no_munging", "anonymous_list": false, "default_member_action": "defer", "scheme": + "http", "list_name": "test", "archive_policy": "public", "collapse_alternatives": + true, "autoresponse_owner_text": "", "request_address": "test-request@example.org", + "acceptable_aliases": [], "include_rfc2369_headers": true, "default_nonmember_action": + "hold", "description": "", "no_reply_address": "noreply@example.org", "welcome_message_uri": + "mailman:///welcome.txt", "advertised": true, "mail_host": "example.org", "bounces_address": "test-bounces@example.org", "autorespond_owner": "none", - "created_at": "2015-11-11T12:49:38.244516", "digest_size_threshold": 30.0, - "web_host": "example.org", "anonymous_list": false, "scheme": "http", "digest_last_sent_at": - null, "subject_prefix": "[Test] ", "mail_host": "example.org", "include_rfc2369_headers": - true}'} + "created_at": "2015-11-11T08:52:21.804288", "autoresponse_grace_period": "90d", + "http_etag": "\"2231d4e997010bb6438b563d2948fac3695a7232\"", "administrivia": + true, "fqdn_listname": "test@example.org", "send_welcome_message": true, "autoresponse_postings_text": + "", "allow_list_posts": true, "digest_size_threshold": 30.0, "admin_immed_notify": + true, "digest_last_sent_at": null, "web_host": "example.org", "first_strip_reply_to": + false, "filter_content": false, "join_address": "test-join@example.org", "next_digest_number": + 1, "owner_address": "test-owner@example.org", "autorespond_requests": "none"}'} headers: content-length: ['1627'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:38 GMT'] + date: ['Wed, 11 Nov 2015 08:52:22 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription.yaml index 3dce68a..c904ff7 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription.yaml @@ -168,6 +168,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:20 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/open_list.example.com/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription_moderate.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription_moderate.yaml index c2e6876..24fa436 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription_moderate.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_subscription_moderate.yaml @@ -169,6 +169,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 08:52:19 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/moderate_subs.example.com/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary.yaml index 5bec76d..f507dc7 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary.yaml @@ -326,6 +326,22 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 12:49:43 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", @@ -345,12 +361,12 @@ method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "total_size": 0, "start": 0}'} + body: {string: !!python/unicode '{"total_size": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0}'} headers: content-length: ['90'] content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:43 GMT'] + date: ['Wed, 11 Nov 2015 08:52:26 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -360,22 +376,6 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/users/test@example.com - response: - body: {string: !!python/unicode '404 Not Found'} - headers: - content-length: ['13'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:43 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 404, message: Not Found} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com response: body: {string: !!python/unicode '{}'} @@ -570,42 +570,6 @@ !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config - response: - body: {string: !!python/unicode '{"autoresponse_grace_period": "90d", "autorespond_requests": - "none", "display_name": "Foo", "default_member_action": "defer", "no_reply_address": - "noreply@example.com", "autorespond_postings": "none", "admin_notify_mchanges": - false, "fqdn_listname": "foo@example.com", "autoresponse_postings_text": "", - "advertised": true, "description": "", "reply_goes_to_list": "no_munging", - "post_id": 1, "filter_content": false, "last_post_at": null, "next_digest_number": - 1, "autoresponse_owner_text": "", "acceptable_aliases": [], "administrivia": - true, "collapse_alternatives": true, "owner_address": "foo-owner@example.com", - "welcome_message_uri": "mailman:///welcome.txt", "allow_list_posts": true, - "subscription_policy": "confirm", "list_name": "foo", "admin_immed_notify": - true, "leave_address": "foo-leave@example.com", "autoresponse_request_text": - "", "posting_pipeline": "default-posting-pipeline", "convert_html_to_plaintext": - false, "reply_to_address": "", "request_address": "foo-request@example.com", - "join_address": "foo-join@example.com", "send_welcome_message": true, "archive_policy": - "public", "volume": 1, "first_strip_reply_to": false, "default_nonmember_action": - "hold", "posting_address": "foo@example.com", "http_etag": "\"06097e71936fc44c4d75a421a3e15230e685359f\"", - "bounces_address": "foo-bounces@example.com", "autorespond_owner": "none", - "created_at": "2015-11-11T12:49:44.045527", "digest_size_threshold": 30.0, - "web_host": "example.com", "anonymous_list": false, "scheme": "http", "digest_last_sent_at": - null, "subject_prefix": "[Foo] ", "mail_host": "example.com", "include_rfc2369_headers": - true}'} - headers: - content-length: ['1617'] - content-type: [application/json; charset=utf-8] - date: ['Wed, 11 Nov 2015 12:49:44 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] - method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists response: body: {string: !!python/unicode '{"entries": [{"display_name": "Foo", "list_id": diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_moderator.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_moderator.yaml new file mode 100644 index 0000000..a28f87c --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_moderator.yaml @@ -0,0 +1,241 @@ +interactions: +- request: + body: password=None&display_name=&email=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + location: ['http://localhost:9001/3.0/users/219398410233519692238726820042175099070'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"mail_host": "example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", + "display_name": "Foo", "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: role=moderator&list_id=foo.example.com&subscriber=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + location: ['http://localhost:9001/3.0/members/64253964043771654525484196513363995267'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"mail_host": "example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", + "display_name": "Foo", "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '{"http_etag": "\"274fc089dca364b6af119eb65e97777f63ad4908\"", + "is_server_owner": false, "created_on": "2015-11-11T10:06:25.323662", "user_id": + 219398410233519692238726820042175099070, "password": "$6$rounds=657737$ktLxC73H3fn7.9kS$1WWJHj/3p0.DS6nI7p.m8kNMC8CgoKZa5QpTcnmTFNkifNHtZAWLuYxgs3xW1gpytVtbf6k3feinGo9QHiGXi.", + "self_link": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070"}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/219398410233519692238726820042175099070 + response: + body: {string: !!python/unicode '{"http_etag": "\"274fc089dca364b6af119eb65e97777f63ad4908\"", + "is_server_owner": false, "created_on": "2015-11-11T10:06:25.323662", "user_id": + 219398410233519692238726820042175099070, "password": "$6$rounds=657737$ktLxC73H3fn7.9kS$1WWJHj/3p0.DS6nI7p.m8kNMC8CgoKZa5QpTcnmTFNkifNHtZAWLuYxgs3xW1gpytVtbf6k3feinGo9QHiGXi.", + "self_link": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070"}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/219398410233519692238726820042175099070/addresses + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"285b48da1d7487a7338bcd1bc4b9783d9840e261\"", + "total_size": 1, "entries": [{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"9d7b8de3c859b9e7d75fc9ec0c357b6667e45198\"", "original_email": + "test@example.com", "registered_on": "2015-11-11T10:06:25.323295", "self_link": + "http://localhost:9001/3.0/addresses/test@example.com", "email": "test@example.com"}]}'} + headers: + content-length: ['432'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"9d7b8de3c859b9e7d75fc9ec0c357b6667e45198\"", "original_email": + "test@example.com", "registered_on": "2015-11-11T10:06:25.323295", "self_link": + "http://localhost:9001/3.0/addresses/test@example.com", "email": "test@example.com"}'} + headers: + content-length: ['327'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"4714ac01bafe8574d550a1583d85d4131856aecb\"", + "total_size": 1, "entries": [{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"53753a482a264202d6d0189bb7873d7122201646\"", "member_id": + 64253964043771654525484196513363995267, "email": "test@example.com", "delivery_mode": + "regular", "address": "http://localhost:9001/3.0/addresses/test@example.com", + "role": "moderator", "list_id": "foo.example.com", "self_link": "http://localhost:9001/3.0/members/64253964043771654525484196513363995267"}]}'} + headers: + content-length: ['566'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"digest_size_threshold": 30.0, "mail_host": + "example.com", "http_etag": "\"8d8e1c058abe7a8b30d33e6be7f82d13150b48cc\"", + "fqdn_listname": "foo@example.com", "reply_goes_to_list": "no_munging", "filter_content": + false, "created_at": "2015-11-11T10:06:24.661601", "web_host": "example.com", + "autorespond_owner": "none", "archive_policy": "public", "join_address": "foo-join@example.com", + "autoresponse_request_text": "", "reply_to_address": "", "posting_address": + "foo@example.com", "post_id": 1, "volume": 1, "admin_notify_mchanges": false, + "autoresponse_grace_period": "90d", "advertised": true, "subject_prefix": + "[Foo] ", "bounces_address": "foo-bounces@example.com", "include_rfc2369_headers": + true, "display_name": "Foo", "send_welcome_message": true, "administrivia": + true, "default_nonmember_action": "hold", "allow_list_posts": true, "description": + "", "next_digest_number": 1, "default_member_action": "defer", "first_strip_reply_to": + false, "subscription_policy": "confirm", "admin_immed_notify": true, "anonymous_list": + false, "autorespond_requests": "none", "list_name": "foo", "last_post_at": + null, "welcome_message_uri": "mailman:///welcome.txt", "convert_html_to_plaintext": + false, "autoresponse_owner_text": "", "no_reply_address": "noreply@example.com", + "request_address": "foo-request@example.com", "scheme": "http", "owner_address": + "foo-owner@example.com", "autorespond_postings": "none", "digest_last_sent_at": + null, "collapse_alternatives": true, "acceptable_aliases": [], "posting_pipeline": + "default-posting-pipeline", "autoresponse_postings_text": "", "leave_address": + "foo-leave@example.com"}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_owner.yaml new file mode 100644 index 0000000..80c7c31 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_owner.yaml @@ -0,0 +1,241 @@ +interactions: +- request: + body: password=None&display_name=&email=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + location: ['http://localhost:9001/3.0/users/219398410233519692238726820042175099070'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"mail_host": "example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", + "display_name": "Foo", "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: role=owner&list_id=foo.example.com&subscriber=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + location: ['http://localhost:9001/3.0/members/64253964043771654525484196513363995267'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"mail_host": "example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", + "display_name": "Foo", "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '{"http_etag": "\"274fc089dca364b6af119eb65e97777f63ad4908\"", + "is_server_owner": false, "created_on": "2015-11-11T10:06:25.323662", "user_id": + 219398410233519692238726820042175099070, "password": "$6$rounds=657737$ktLxC73H3fn7.9kS$1WWJHj/3p0.DS6nI7p.m8kNMC8CgoKZa5QpTcnmTFNkifNHtZAWLuYxgs3xW1gpytVtbf6k3feinGo9QHiGXi.", + "self_link": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070"}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/219398410233519692238726820042175099070 + response: + body: {string: !!python/unicode '{"http_etag": "\"274fc089dca364b6af119eb65e97777f63ad4908\"", + "is_server_owner": false, "created_on": "2015-11-11T10:06:25.323662", "user_id": + 219398410233519692238726820042175099070, "password": "$6$rounds=657737$ktLxC73H3fn7.9kS$1WWJHj/3p0.DS6nI7p.m8kNMC8CgoKZa5QpTcnmTFNkifNHtZAWLuYxgs3xW1gpytVtbf6k3feinGo9QHiGXi.", + "self_link": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070"}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/219398410233519692238726820042175099070/addresses + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"285b48da1d7487a7338bcd1bc4b9783d9840e261\"", + "total_size": 1, "entries": [{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"9d7b8de3c859b9e7d75fc9ec0c357b6667e45198\"", "original_email": + "test@example.com", "registered_on": "2015-11-11T10:06:25.323295", "self_link": + "http://localhost:9001/3.0/addresses/test@example.com", "email": "test@example.com"}]}'} + headers: + content-length: ['432'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"9d7b8de3c859b9e7d75fc9ec0c357b6667e45198\"", "original_email": + "test@example.com", "registered_on": "2015-11-11T10:06:25.323295", "self_link": + "http://localhost:9001/3.0/addresses/test@example.com", "email": "test@example.com"}'} + headers: + content-length: ['327'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"4714ac01bafe8574d550a1583d85d4131856aecb\"", + "total_size": 1, "entries": [{"user": "http://localhost:9001/3.0/users/219398410233519692238726820042175099070", + "http_etag": "\"53753a482a264202d6d0189bb7873d7122201646\"", "member_id": + 64253964043771654525484196513363995267, "email": "test@example.com", "delivery_mode": + "regular", "address": "http://localhost:9001/3.0/addresses/test@example.com", + "role": "owner", "list_id": "foo.example.com", "self_link": "http://localhost:9001/3.0/members/64253964043771654525484196513363995267"}]}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"start": 0, "http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "total_size": 0}'} + headers: + content-length: ['566'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"digest_size_threshold": 30.0, "mail_host": + "example.com", "http_etag": "\"8d8e1c058abe7a8b30d33e6be7f82d13150b48cc\"", + "fqdn_listname": "foo@example.com", "reply_goes_to_list": "no_munging", "filter_content": + false, "created_at": "2015-11-11T10:06:24.661601", "web_host": "example.com", + "autorespond_owner": "none", "archive_policy": "public", "join_address": "foo-join@example.com", + "autoresponse_request_text": "", "reply_to_address": "", "posting_address": + "foo@example.com", "post_id": 1, "volume": 1, "admin_notify_mchanges": false, + "autoresponse_grace_period": "90d", "advertised": true, "subject_prefix": + "[Foo] ", "bounces_address": "foo-bounces@example.com", "include_rfc2369_headers": + true, "display_name": "Foo", "send_welcome_message": true, "administrivia": + true, "default_nonmember_action": "hold", "allow_list_posts": true, "description": + "", "next_digest_number": 1, "default_member_action": "defer", "first_strip_reply_to": + false, "subscription_policy": "confirm", "admin_immed_notify": true, "anonymous_list": + false, "autorespond_requests": "none", "list_name": "foo", "last_post_at": + null, "welcome_message_uri": "mailman:///welcome.txt", "convert_html_to_plaintext": + false, "autoresponse_owner_text": "", "no_reply_address": "noreply@example.com", + "request_address": "foo-request@example.com", "scheme": "http", "owner_address": + "foo-owner@example.com", "autorespond_postings": "none", "digest_last_sent_at": + null, "collapse_alternatives": true, "acceptable_aliases": [], "posting_pipeline": + "default-posting-pipeline", "autoresponse_postings_text": "", "leave_address": + "foo-leave@example.com"}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 10:06:26 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_moderator.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_moderator.yaml new file mode 100644 index 0000000..0e01252 --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_moderator.yaml @@ -0,0 +1,313 @@ +interactions: +- request: + body: display_name=&password=None&email=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:54 GMT'] + location: ['http://localhost:9001/3.0/users/270387690459968603267458687775118477393'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: email=anotheremail%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393/addresses + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + location: ['http://localhost:9001/3.0/addresses/anotheremail@example.com'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com/verify + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"list_id": "foo.example.com", "mail_host": "example.com", + "list_name": "foo", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "fqdn_listname": "foo@example.com", "volume": 1, "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "display_name": "Foo"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: role=moderator&list_id=foo.example.com&subscriber=anotheremail%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + location: ['http://localhost:9001/3.0/members/167810063128386830859080802237709622397'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"list_id": "foo.example.com", "mail_host": "example.com", + "list_name": "foo", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "fqdn_listname": "foo@example.com", "volume": 1, "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "display_name": "Foo"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "created_on": "2015-11-11T09:15:54.098984", "user_id": 270387690459968603267458687775118477393, + "http_etag": "\"b1f415040c829e111a4cad8afd8efeda7bda929a\"", "password": "$6$rounds=626264$cNtQFSnFZ4S/DTbL$fp.zIYsm6IC34B46G0LugZtfY8E93Oojw.hTmFH7YRcX6k8K/pEk/U4hrIC8DmSCTvtmoCqactE7cS9i6Wns0/", + "is_server_owner": false}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393 + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "created_on": "2015-11-11T09:15:54.098984", "user_id": 270387690459968603267458687775118477393, + "http_etag": "\"b1f415040c829e111a4cad8afd8efeda7bda929a\"", "password": "$6$rounds=626264$cNtQFSnFZ4S/DTbL$fp.zIYsm6IC34B46G0LugZtfY8E93Oojw.hTmFH7YRcX6k8K/pEk/U4hrIC8DmSCTvtmoCqactE7cS9i6Wns0/", + "is_server_owner": false}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393/addresses + response: + body: {string: !!python/unicode '{"http_etag": "\"095c886cc2c87267e121d4a1974b495183e6fd93\"", + "start": 0, "total_size": 2, "entries": [{"self_link": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "registered_on": "2015-11-11T09:15:54.974939", "http_etag": "\"989cb1d30416a8dd9f2f7abf31a94c085af851c6\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "anotheremail@example.com", "verified_on": "2015-11-11T09:15:55.068609", + "original_email": "anotheremail@example.com"}, {"self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "registered_on": "2015-11-11T09:15:54.098549", "http_etag": "\"c95a6da19b8041a3a01d616f8daa2115690badfc\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "test@example.com", "original_email": "test@example.com"}]}'} + headers: + content-length: ['830'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "registered_on": "2015-11-11T09:15:54.974939", "http_etag": "\"989cb1d30416a8dd9f2f7abf31a94c085af851c6\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "anotheremail@example.com", "verified_on": "2015-11-11T09:15:55.068609", + "original_email": "anotheremail@example.com"}'} + headers: + content-length: ['396'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "registered_on": "2015-11-11T09:15:54.098549", "http_etag": "\"c95a6da19b8041a3a01d616f8daa2115690badfc\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "test@example.com", "original_email": "test@example.com"}'} + headers: + content-length: ['327'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['580'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"http_etag": "\"4d9619b758f2e0c5bf8f7c65460e199a9a13ad65\"", + "start": 0, "total_size": 1, "entries": [{"self_link": "http://localhost:9001/3.0/members/167810063128386830859080802237709622397", + "member_id": 167810063128386830859080802237709622397, "role": "moderator", "http_etag": + "\"7ffccfad084044c9b107a08e659d827ee46d1500\"", "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "address": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "email": "anotheremail@example.com", "list_id": "foo.example.com", "delivery_mode": + "regular"}]}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/anotheremail@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"filter_content": false, "display_name": "Foo", + "autorespond_postings": "none", "autorespond_requests": "none", "web_host": + "example.com", "volume": 1, "include_rfc2369_headers": true, "subscription_policy": + "confirm", "admin_immed_notify": true, "mail_host": "example.com", "posting_pipeline": + "default-posting-pipeline", "join_address": "foo-join@example.com", "administrivia": + true, "autorespond_owner": "none", "no_reply_address": "noreply@example.com", + "archive_policy": "public", "digest_size_threshold": 30.0, "request_address": + "foo-request@example.com", "admin_notify_mchanges": false, "welcome_message_uri": + "mailman:///welcome.txt", "scheme": "http", "default_nonmember_action": "hold", + "convert_html_to_plaintext": false, "autoresponse_owner_text": "", "description": + "", "list_name": "foo", "bounces_address": "foo-bounces@example.com", "subject_prefix": + "[Foo] ", "posting_address": "foo@example.com", "reply_goes_to_list": "no_munging", + "anonymous_list": false, "autoresponse_postings_text": "", "post_id": 1, "allow_list_posts": + true, "next_digest_number": 1, "created_at": "2015-11-11T09:15:53.622121", + "collapse_alternatives": true, "owner_address": "foo-owner@example.com", "acceptable_aliases": + [], "last_post_at": null, "first_strip_reply_to": false, "reply_to_address": + "", "leave_address": "foo-leave@example.com", "fqdn_listname": "foo@example.com", + "send_welcome_message": true, "default_member_action": "defer", "advertised": + true, "autoresponse_grace_period": "90d", "http_etag": "\"a10382b38c19ab3f96aba0b521660b0a3bec0b5f\"", + "autoresponse_request_text": "", "digest_last_sent_at": null}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +version: 1 diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_owner.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_owner.yaml new file mode 100644 index 0000000..923c1bf --- /dev/null +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_summary_secondary_owner.yaml @@ -0,0 +1,313 @@ +interactions: +- request: + body: display_name=&password=None&email=test%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:54 GMT'] + location: ['http://localhost:9001/3.0/users/270387690459968603267458687775118477393'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: email=anotheremail%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393/addresses + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + location: ['http://localhost:9001/3.0/addresses/anotheremail@example.com'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com/verify + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"list_id": "foo.example.com", "mail_host": "example.com", + "list_name": "foo", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "fqdn_listname": "foo@example.com", "volume": 1, "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "display_name": "Foo"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: role=owner&list_id=foo.example.com&subscriber=anotheremail%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + location: ['http://localhost:9001/3.0/members/167810063128386830859080802237709622397'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"list_id": "foo.example.com", "mail_host": "example.com", + "list_name": "foo", "member_count": 0, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "fqdn_listname": "foo@example.com", "volume": 1, "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", + "display_name": "Foo"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/test@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "created_on": "2015-11-11T09:15:54.098984", "user_id": 270387690459968603267458687775118477393, + "http_etag": "\"b1f415040c829e111a4cad8afd8efeda7bda929a\"", "password": "$6$rounds=626264$cNtQFSnFZ4S/DTbL$fp.zIYsm6IC34B46G0LugZtfY8E93Oojw.hTmFH7YRcX6k8K/pEk/U4hrIC8DmSCTvtmoCqactE7cS9i6Wns0/", + "is_server_owner": false}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393 + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "created_on": "2015-11-11T09:15:54.098984", "user_id": 270387690459968603267458687775118477393, + "http_etag": "\"b1f415040c829e111a4cad8afd8efeda7bda929a\"", "password": "$6$rounds=626264$cNtQFSnFZ4S/DTbL$fp.zIYsm6IC34B46G0LugZtfY8E93Oojw.hTmFH7YRcX6k8K/pEk/U4hrIC8DmSCTvtmoCqactE7cS9i6Wns0/", + "is_server_owner": false}'} + headers: + content-length: ['407'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/270387690459968603267458687775118477393/addresses + response: + body: {string: !!python/unicode '{"http_etag": "\"095c886cc2c87267e121d4a1974b495183e6fd93\"", + "start": 0, "total_size": 2, "entries": [{"self_link": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "registered_on": "2015-11-11T09:15:54.974939", "http_etag": "\"989cb1d30416a8dd9f2f7abf31a94c085af851c6\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "anotheremail@example.com", "verified_on": "2015-11-11T09:15:55.068609", + "original_email": "anotheremail@example.com"}, {"self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "registered_on": "2015-11-11T09:15:54.098549", "http_etag": "\"c95a6da19b8041a3a01d616f8daa2115690badfc\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "test@example.com", "original_email": "test@example.com"}]}'} + headers: + content-length: ['830'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/anotheremail@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "registered_on": "2015-11-11T09:15:54.974939", "http_etag": "\"989cb1d30416a8dd9f2f7abf31a94c085af851c6\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "anotheremail@example.com", "verified_on": "2015-11-11T09:15:55.068609", + "original_email": "anotheremail@example.com"}'} + headers: + content-length: ['396'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/addresses/test@example.com + response: + body: {string: !!python/unicode '{"self_link": "http://localhost:9001/3.0/addresses/test@example.com", + "registered_on": "2015-11-11T09:15:54.098549", "http_etag": "\"c95a6da19b8041a3a01d616f8daa2115690badfc\"", + "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "email": "test@example.com", "original_email": "test@example.com"}'} + headers: + content-length: ['327'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"http_etag": "\"4d9619b758f2e0c5bf8f7c65460e199a9a13ad65\"", + "start": 0, "total_size": 1, "entries": [{"self_link": "http://localhost:9001/3.0/members/167810063128386830859080802237709622397", + "member_id": 167810063128386830859080802237709622397, "role": "owner", "http_etag": + "\"7ffccfad084044c9b107a08e659d827ee46d1500\"", "user": "http://localhost:9001/3.0/users/270387690459968603267458687775118477393", + "address": "http://localhost:9001/3.0/addresses/anotheremail@example.com", + "email": "anotheremail@example.com", "list_id": "foo.example.com", "delivery_mode": + "regular"}]}'} + headers: + content-length: ['580'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/test@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/member/anotheremail@example.com + response: + body: {string: !!python/unicode '{}'} + headers: + content-length: ['2'] + content-type: [application/json] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"filter_content": false, "display_name": "Foo", + "autorespond_postings": "none", "autorespond_requests": "none", "web_host": + "example.com", "volume": 1, "include_rfc2369_headers": true, "subscription_policy": + "confirm", "admin_immed_notify": true, "mail_host": "example.com", "posting_pipeline": + "default-posting-pipeline", "join_address": "foo-join@example.com", "administrivia": + true, "autorespond_owner": "none", "no_reply_address": "noreply@example.com", + "archive_policy": "public", "digest_size_threshold": 30.0, "request_address": + "foo-request@example.com", "admin_notify_mchanges": false, "welcome_message_uri": + "mailman:///welcome.txt", "scheme": "http", "default_nonmember_action": "hold", + "convert_html_to_plaintext": false, "autoresponse_owner_text": "", "description": + "", "list_name": "foo", "bounces_address": "foo-bounces@example.com", "subject_prefix": + "[Foo] ", "posting_address": "foo@example.com", "reply_goes_to_list": "no_munging", + "anonymous_list": false, "autoresponse_postings_text": "", "post_id": 1, "allow_list_posts": + true, "next_digest_number": 1, "created_at": "2015-11-11T09:15:53.622121", + "collapse_alternatives": true, "owner_address": "foo-owner@example.com", "acceptable_aliases": + [], "last_post_at": null, "first_strip_reply_to": false, "reply_to_address": + "", "leave_address": "foo-leave@example.com", "fqdn_listname": "foo@example.com", + "send_welcome_message": true, "default_member_action": "defer", "advertised": + true, "autoresponse_grace_period": "90d", "http_etag": "\"a10382b38c19ab3f96aba0b521660b0a3bec0b5f\"", + "autoresponse_request_text": "", "digest_last_sent_at": null}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 11 Nov 2015 09:15:55 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +version: 1 diff --git a/src/postorius/tests/mailman_api_tests/test_list_summary.py b/src/postorius/tests/mailman_api_tests/test_list_summary.py index 26f86a5..b5c8b5d 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_summary.py +++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py @@ -91,7 +91,8 @@ mlist = self.mmclient.get_list('foo@example.com') mlist.subscribe('test@example.com') user = self.mmclient.get_user('test@example.com') - user.add_address('anotheremail@example.com') + address = user.add_address('anotheremail@example.com') + address.verify() self.client.login(username='testuser', password='testpass') response = self.client.get(reverse('list_summary', args=('foo@example.com', ))) @@ -110,3 +111,55 @@ self.assertEqual(response.status_code, 200) self.assertTrue('Change Subscription' in response.content) self.assertTrue('Unsubscribe' in response.content) + + @MM_VCR.use_cassette('test_list_summary_owner.yaml') + def test_list_summary_owner(self): + # Response must contain the administration menu + user = self.mmclient.create_user('test@example.com', None) + mlist = self.mmclient.get_list('foo@example.com') + mlist.add_owner('test@example.com') + self.client.login(username='testuser', password='testpass') + response = self.client.get(reverse('list_summary', + args=('foo@example.com', ))) + self.assertEqual(response.status_code, 200) + self.assertContains(response, '
  • ', count=9) + + @MM_VCR.use_cassette('test_list_summary_moderator.yaml') + def test_list_summary_moderator(self): + # Response must contain the administration menu + user = self.mmclient.create_user('test@example.com', None) + mlist = self.mmclient.get_list('foo@example.com') + mlist.add_moderator('test@example.com') + self.client.login(username='testuser', password='testpass') + response = self.client.get(reverse('list_summary', + args=('foo@example.com', ))) + self.assertEqual(response.status_code, 200) + self.assertContains(response, '
  • ', count=3) + + @MM_VCR.use_cassette('test_list_summary_secondary_owner.yaml') + def test_list_summary_is_admin_secondary_owner(self): + # Response must contain the administration menu + user = self.mmclient.create_user('test@example.com', None) + address = user.add_address('anotheremail@example.com') + address.verify() + mlist = self.mmclient.get_list('foo@example.com') + mlist.add_owner('anotheremail@example.com') + self.client.login(username='testuser', password='testpass') + response = self.client.get(reverse('list_summary', + args=('foo@example.com', ))) + self.assertEqual(response.status_code, 200) + self.assertContains(response, '
  • ', count=9) + + @MM_VCR.use_cassette('test_list_summary_secondary_moderator.yaml') + def test_list_summary_is_admin_secondary_moderator(self): + # Response must contain the administration menu + user = self.mmclient.create_user('test@example.com', None) + address = user.add_address('anotheremail@example.com') + address.verify() + mlist = self.mmclient.get_list('foo@example.com') + mlist.add_moderator('anotheremail@example.com') + self.client.login(username='testuser', password='testpass') + response = self.client.get(reverse('list_summary', + args=('foo@example.com', ))) + self.assertEqual(response.status_code, 200) + self.assertContains(response, '
  • ', count=3) diff --git a/src/postorius/utils.py b/src/postorius/utils.py index 37a4011..a34ff63 100644 --- a/src/postorius/utils.py +++ b/src/postorius/utils.py @@ -43,6 +43,7 @@ "Please start Mailman core."}, context_instance=RequestContext(request)) + def paginate(request, collection, count=20): # count is the number of items per page paginator = Paginator(collection, count) @@ -56,3 +57,31 @@ # If page is out of range (e.g. 9999), deliver last page of results. results = paginator.page(paginator.num_pages) return results + + +def set_other_emails(user): + from postorius.models import MailmanUser, MailmanApiError, Mailman404Error + user.other_emails = [] + if not user.is_authenticated(): + return + try: + mm_user = MailmanUser.objects.get(address=user.email) + user.other_emails = [str(address) for address in mm_user.addresses + if address.verified_on is not None] + except (MailmanApiError, Mailman404Error, AttributeError): + # MailmanApiError: No connection to Mailman + # Mailman404Error: The user does not have a mailman user associated with it. + # AttributeError: Anonymous user + return + if user.email in user.other_emails: + user.other_emails.remove(user.email) + +def user_is_in_list_roster(user, mailing_list, roster): + if not user.is_authenticated(): + return False + if not hasattr(user, 'other_emails'): + set_other_emails(user) + addresses = set([user.email]) | set(user.other_emails) + if addresses & set(getattr(mailing_list, roster)): + return True # At least one address is in the roster + return False diff --git a/src/postorius/views/generic.py b/src/postorius/views/generic.py index 8fd1bdb..896a098 100644 --- a/src/postorius/views/generic.py +++ b/src/postorius/views/generic.py @@ -48,20 +48,6 @@ def _get_list(self, list_id, page): return List.objects.get_or_404(fqdn_listname=list_id) - def _is_list_owner(self, user, mailing_list): - if not user.is_authenticated(): - return False - if user.email in mailing_list.owners: - return True - return False - - def _is_list_moderator(self, user, mailing_list): - if not user.is_authenticated(): - return False - if user.email in mailing_list.moderators: - return True - return False - def dispatch(self, request, *args, **kwargs): # get the list object. if 'list_id' in kwargs: @@ -70,10 +56,11 @@ int(kwargs.get('page', 1))) except MailmanApiError: return utils.render_api_error(request) - request.user.is_list_owner = self._is_list_owner( - request.user, self.mailing_list) - request.user.is_list_moderator = self._is_list_moderator( - request.user, self.mailing_list) + utils.set_other_emails(request.user) + request.user.is_list_owner = utils.user_is_in_list_roster( + request.user, self.mailing_list, "owners") + request.user.is_list_moderator = utils.user_is_in_list_roster( + request.user, self.mailing_list, "moderators") # set the template if 'template' in kwargs: self.template = kwargs['template'] @@ -85,7 +72,7 @@ """A generic view for everything based on a mailman.client user object. - Sets self.mm_user to list object if user_id in **kwargs. + Sets self.mm_user to user object if user_id in **kwargs. """ def _get_first_address(self, user_obj): diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index ec65272..a580d25 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -176,36 +176,28 @@ """ def get(self, request, list_id): - try: - mm_user = MailmanUser.objects.get(address=request.user.email) - user_emails = [str(address) for address in getattr(mm_user, 'addresses')] - # TODO:maxking - add the clause below in above - # statement after the subscription policy is sorted out - # if address.verified_on is not None] - except Mailman404Error: - # The user does not have a mailman user associated with it. - user_emails = [request.user.email] - except AttributeError: - # Anonymous User, everyone logged out. + if request.user.is_authenticated(): + user_emails = [request.user.email] + request.user.other_emails + else: user_emails = None userSubscribed = False subscribed_address = None - if user_emails is not None: + data = {'list': self.mailing_list, + 'userSubscribed': False, + 'subscribed_address': None} + if request.user.is_authenticated(): for address in user_emails: try: - userMember = self.mailing_list.get_member(address) + self.mailing_list.get_member(address) except ValueError: pass else: - userSubscribed = True - subscribed_address = address - data = {'list': self.mailing_list, - 'userSubscribed': userSubscribed, - 'subscribed_address': subscribed_address} - if user_emails is not None: - data['change_subscription_form'] = ChangeSubscriptionForm(user_emails, - initial={'email': subscribed_address}) + data['userSubscribed'] = True + data['subscribed_address'] = address + break # no need to test more addresses + data['change_subscription_form'] = ChangeSubscriptionForm( + user_emails, initial={'email': data['subscribed_address']}) data['subscribe_form'] = ListSubscribe(user_emails) else: data['change_subscription_form'] = None @@ -220,8 +212,7 @@ @method_decorator(login_required) def post(self, request, list_id): try: - mm_user = MailmanUser.objects.get(address=request.user.email) - user_emails = [str(address) for address in mm_user.addresses] + user_emails = [request.user.email] + request.user.other_emails form = ListSubscribe(user_emails, request.POST) for address in user_emails: try: @@ -231,6 +222,7 @@ else: userSubscribed = True old_email = address + break # no need to test more addresses if form.is_valid(): email = form.cleaned_data['email'] if old_email == email: @@ -261,12 +253,9 @@ redirects to the `list_summary` view. """ try: - try: - mm_user = MailmanUser.objects.get(address=request.user.email) - user_addresses = [str(address) for address in mm_user.addresses] - except Mailman404Error: - mm_user = None - user_addresses = (request.POST.get('email'),) + user_addresses = [request.user.email] + request.user.other_emails + if not user_addresses: + user_addresses = [request.POST.get('email')] form = ListSubscribe(user_addresses, request.POST) if form.is_valid(): email = request.POST.get('email') diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index c9c26e0..ece5def 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -304,12 +304,13 @@ @login_required() def user_profile(request, user_email=None): - # try: - # the_user = User.objects.get(email=user_email) - # except MailmanApiError: - # return utils.render_api_error(request) + utils.set_other_emails(request.user) + try: + mm_user = MailmanUser.objects.get(address=request.user.email) + except MailmanApiError: + return utils.render_api_error(request) return render_to_response('postorius/user_profile.html', - # {'mm_user': the_user}, + {'mm_user': mm_user}, context_instance=RequestContext(request))