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 3241650..68685b9 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 @@ -7,26 +7,11 @@ method: !!python/unicode 'POST' uri: http://localhost:9001/3.0/domains response: - body: {string: !!python/unicode 'Duplicate email host: example.com'} + body: {string: !!python/unicode ''} headers: - content-length: ['33'] - content-type: [application/json; charset=utf-8] - status: {code: 400, message: Bad Request} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} + content-length: ['0'] + location: ['http://localhost:9001/3.0/domains/example.com'] + status: {code: 201, message: Created} - request: body: null headers: @@ -60,7 +45,7 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/lists/foo.example.com response: body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", @@ -74,126 +59,54 @@ body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/users/su@example.com - response: - body: {string: !!python/unicode '404 Not Found'} - headers: - content-length: ['13'] - content-type: [application/json; charset=utf-8] - status: {code: 404, message: Not Found} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/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] - status: {code: 200, message: OK} -- request: - body: role=owner&list_id=foo.example.com&subscriber=newowner%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] - method: !!python/unicode 'POST' - uri: http://localhost:9001/3.0/members + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/lists/foo@example.com response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - location: ['http://localhost:9001/3.0/members/2'] + status: {code: 204, message: No Content} +- request: + body: mail_host=example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/domains + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/domains/example.com'] status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=1&page=1 + uri: http://localhost:9001/3.0/domains/example.com response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} + body: {string: !!python/unicode '{"base_url": "http://example.com", "description": + null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": + "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", + "url_host": "example.com"}'} headers: - content-length: ['90'] + content-length: ['233'] content-type: [application/json; charset=utf-8] status: {code: 200, message: OK} - request: - body: null + body: fqdn_listname=foo%40example.com headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=25&page=1 + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/lists response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} + body: {string: !!python/unicode ''} headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner - response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", - "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": - "\"3cd95533f48bade9cf7cd736dc8610586e170db5\"", "list_id": "foo.example.com", - "member_id": 2, "role": "owner", "self_link": "http://localhost:9001/3.0/members/2", - "user": "http://localhost:9001/3.0/users/2"}], "http_etag": "\"3f55a6e8ce307f1b4eb9244a084bf49b7759e0ef\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['458'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator - response: - body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", - "start": 0, "total_size": 0}'} - headers: - content-length: ['90'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner - response: - body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", - "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": - "\"3cd95533f48bade9cf7cd736dc8610586e170db5\"", "list_id": "foo.example.com", - "member_id": 2, "role": "owner", "self_link": "http://localhost:9001/3.0/members/2", - "user": "http://localhost:9001/3.0/users/2"}], "http_etag": "\"3f55a6e8ce307f1b4eb9244a084bf49b7759e0ef\"", - "start": 0, "total_size": 1}'} - headers: - content-length: ['458'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} + content-length: ['0'] + location: ['http://localhost:9001/3.0/lists/foo.example.com'] + status: {code: 201, message: Created} - request: body: null headers: diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner_new_owner_added.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner_new_owner_added.yaml index abf1f66..0c62831 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner_new_owner_added.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_members_add_owner_new_owner_added.yaml @@ -4,13 +4,274 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/su@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/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] + status: {code: 200, message: OK} +- request: + body: subscriber=newowner%40example.com&role=owner&list_id=foo.example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/109'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=1&page=1 + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=25&page=1 + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner response: body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": - "\"3cd95533f48bade9cf7cd736dc8610586e170db5\"", "list_id": "foo.example.com", - "member_id": 2, "role": "owner", "self_link": "http://localhost:9001/3.0/members/2", - "user": "http://localhost:9001/3.0/users/2"}], "http_etag": "\"3f55a6e8ce307f1b4eb9244a084bf49b7759e0ef\"", + "\"3d5a7162cfea3a3714cffd29d27ebde67d79a761\"", "list_id": "foo.example.com", + "member_id": 109, "role": "owner", "self_link": "http://localhost:9001/3.0/members/109", + "user": "http://localhost:9001/3.0/users/127"}], "http_etag": "\"58b1525f8309e885c67d43ddb5be942764bc9d6d\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['464'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", + "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": + "\"3d5a7162cfea3a3714cffd29d27ebde67d79a761\"", "list_id": "foo.example.com", + "member_id": 109, "role": "owner", "self_link": "http://localhost:9001/3.0/members/109", + "user": "http://localhost:9001/3.0/users/127"}], "http_etag": "\"58b1525f8309e885c67d43ddb5be942764bc9d6d\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['464'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com + response: + body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", + "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", + "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": + "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/users/su@example.com + response: + body: {string: !!python/unicode '404 Not Found'} + headers: + content-length: ['13'] + content-type: [application/json; charset=utf-8] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/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] + status: {code: 200, message: OK} +- request: + body: subscriber=newowner%40example.com&role=owner&list_id=foo.example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/members + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/members/1'] + status: {code: 201, message: Created} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=1&page=1 + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/roster/member?count=25&page=1 + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", + "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": + "\"1e656e8469afe5acc1725ce34ba2d64c95d401bb\"", "list_id": "foo.example.com", + "member_id": 1, "role": "owner", "self_link": "http://localhost:9001/3.0/members/1", + "user": "http://localhost:9001/3.0/users/1"}], "http_etag": "\"6d8e08bc7a0c4c26e574f282f7c140254cc57531\"", + "start": 0, "total_size": 1}'} + headers: + content-length: ['458'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/moderator + response: + body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"", + "start": 0, "total_size": 0}'} + headers: + content-length: ['90'] + content-type: [application/json; charset=utf-8] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo.example.com/roster/owner + response: + body: {string: !!python/unicode '{"entries": [{"address": "http://localhost:9001/3.0/addresses/newowner@example.com", + "delivery_mode": "regular", "email": "newowner@example.com", "http_etag": + "\"1e656e8469afe5acc1725ce34ba2d64c95d401bb\"", "list_id": "foo.example.com", + "member_id": 1, "role": "owner", "self_link": "http://localhost:9001/3.0/members/1", + "user": "http://localhost:9001/3.0/users/1"}], "http_etag": "\"6d8e08bc7a0c4c26e574f282f7c140254cc57531\"", "start": 0, "total_size": 1}'} headers: content-length: ['458'] diff --git a/src/postorius/tests/mailman_api_tests/test_list_members.py b/src/postorius/tests/mailman_api_tests/test_list_members.py index 2364eed..4afa51c 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_members.py +++ b/src/postorius/tests/mailman_api_tests/test_list_members.py @@ -129,10 +129,6 @@ 'su', 'su@example.com', 'pwd') # login and post new owner data to url self.client.login(username='su', password='pwd') - self.client.post( - reverse('list_members', args=('foo@example.com', )), - {'owner_email': 'newowner@example.com'}) - owners = self.foo_list.owners @MM_VCR.use_cassette('test_list_members_add_owner.yaml') def tearDown(self): @@ -141,6 +137,9 @@ @MM_VCR.use_cassette('test_list_members_add_owner_new_owner_added.yaml') def test_new_owner_added(self): + self.client.post( + reverse('list_members', args=('foo@example.com', )), + {'owner_email': 'newowner@example.com'}) self.assertTrue(u'newowner@example.com' in self.foo_list.owners)