diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_address_activation.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_address_activation.yaml index 417907a..2746eb2 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_address_activation.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_address_activation.yaml @@ -1,263 +1,46 @@ interactions: - request: - body: mail_host=example.com + body: email=subscribed%40example.org&password=password 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 + uri: http://localhost:9001/3.0/users response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] + location: ['http://localhost:9001/3.0/users/1881'] status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"244ad281ce0937d4369ac0b39044e359b464c006\"", - "token": "617c0d27255768ccede8c62edad29f0dade35601", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/users/1881 response: body: {string: !!python/unicode ''} headers: content-length: ['0'] status: {code: 204, message: No Content} - request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: mail_host=example.com + body: email=subscribed%40example.org&password=password 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 + uri: http://localhost:9001/3.0/users response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] + location: ['http://localhost:9001/3.0/users/1882'] status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"05026f6a5f6e62a5787d48ee2a3489c788f71212\"", - "token": "d8d679afd8f787f9259997d56aaf5f80f753f7a3", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: mail_host=example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/domains - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"0622c1528bc8361937513c083ae88acedc6aaf77\"", - "token": "58bf3076ae2014a48f5de91480c49a5aac717841", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET uri: http://localhost:9001/3.0/users/expired@example.org response: body: {string: !!python/unicode 404 Not Found} @@ -270,105 +53,38 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/users/1882 response: body: {string: !!python/unicode ''} headers: content-length: ['0'] status: {code: 204, message: No Content} - request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: mail_host=example.com + body: email=subscribed%40example.org&password=password 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 + uri: http://localhost:9001/3.0/users response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] + location: ['http://localhost:9001/3.0/users/1883'] status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"f42b3613dcf00ea761bc03a394019698ff959fb2\"", - "token": "c8c0e7e54396de27b04afdc7905f23b19bed3319", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET uri: http://localhost:9001/3.0/users/subscribed@example.org response: - body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "display_name": - "None", "http_etag": "\"d5924f9c3590feabf8a641335713bed5cd663212\"", "is_server_owner": - false, "self_link": "http://localhost:9001/3.0/users/1527", "user_id": 1527}'} + body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag": + "\"aef2be6373d039f3c26769f3eb033b21185c8817\"", "is_server_owner": false, + "password": "$6$rounds=631015$2Z59WghziNfKCrWC$JuV8ayS7XVdOnPzYOKn4qTxm8XlpL.aDYHhcHDo3.mvkC473gjLEpEObyzt4g51oPp0M/BiZ2k.vyY8DWX9U01", + "self_link": "http://localhost:9001/3.0/users/1883", "user_id": 1883}'} headers: - content-length: ['218'] + content-length: ['330'] content-type: [application/json; charset=utf-8] status: {code: 200, message: OK} - request: @@ -376,190 +92,54 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com + uri: http://localhost:9001/3.0/users/1883 response: body: {string: !!python/unicode ''} headers: content-length: ['0'] status: {code: 204, message: No Content} - request: + body: email=subscribed%40example.org&password=password + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] + method: !!python/unicode POST + uri: http://localhost:9001/3.0/users + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + location: ['http://localhost:9001/3.0/users/1884'] + status: {code: 201, message: Created} +- request: body: null headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com + uri: http://localhost:9001/3.0/users/1884 response: body: {string: !!python/unicode ''} headers: content-length: ['0'] status: {code: 204, message: No Content} - request: - body: mail_host=example.com + body: email=subscribed%40example.org&password=password 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 + uri: http://localhost:9001/3.0/users response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] + location: ['http://localhost:9001/3.0/users/1885'] status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"6fd2efa57c024cd458a13b5e857ce7604980810b\"", - "token": "fdea25c6056d29e827ac4de0681eb05a85785daf", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: mail_host=example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/domains - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/domains/example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "description": - null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "mail_host": - "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com", - "url_host": "example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: fqdn_listname=foo%40example.com - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/lists - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - location: ['http://localhost:9001/3.0/lists/foo.example.com'] - status: {code: 201, message: Created} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET - uri: http://localhost:9001/3.0/lists/foo.example.com - response: - body: {string: !!python/unicode '{"display_name": "Foo", "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "list_id": "foo.example.com", - "list_name": "foo", "mail_host": "example.com", "member_count": 0, "self_link": - "http://localhost:9001/3.0/lists/foo.example.com", "volume": 1}'} - headers: - content-length: ['294'] - content-type: [application/json; charset=utf-8] - status: {code: 200, message: OK} -- request: - body: display_name=None&list_id=foo.example.com&subscriber=subscribed%40example.org - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded] - method: !!python/unicode POST - uri: http://localhost:9001/3.0/members - response: - body: {string: !!python/unicode '{"http_etag": "\"7cbc137b10520d2d4d25297171b35c4f95aca43e\"", - "token": "f9e5fcd7b8413d8e76b53e8da745bd060424c572", "token_owner": "subscriber"}'} - headers: - content-length: ['143'] - content-type: [application/json; charset=utf-8] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode GET uri: http://localhost:9001/3.0/users/very_new_email@example.org response: body: {string: !!python/unicode 404 Not Found} @@ -572,18 +152,7 @@ headers: accept-encoding: ['gzip, deflate'] method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/lists/foo@example.com - response: - body: {string: !!python/unicode ''} - headers: - content-length: ['0'] - status: {code: 204, message: No Content} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - method: !!python/unicode DELETE - uri: http://localhost:9001/3.0/domains/example.com + uri: http://localhost:9001/3.0/users/1885 response: body: {string: !!python/unicode ''} headers: diff --git a/src/postorius/tests/mailman_api_tests/test_address_activation.py b/src/postorius/tests/mailman_api_tests/test_address_activation.py index 397bc74..d67ae6e 100644 --- a/src/postorius/tests/mailman_api_tests/test_address_activation.py +++ b/src/postorius/tests/mailman_api_tests/test_address_activation.py @@ -38,17 +38,14 @@ self.user) self.expired.created -= timedelta(weeks=100) self.expired.save() - domain = get_client().create_domain('example.com') - self.foo_list = domain.create_list('foo') - self.foo_list.subscribe('subscribed@example.org') + self.mm_user = get_client().create_user('subscribed@example.org', 'password') @MM_VCR.use_cassette('test_address_activation.yaml') def tearDown(self): self.profile.delete() self.expired.delete() self.user.delete() - self.foo_list.delete() - get_client().delete_domain('example.com') + self.mm_user.delete() @MM_VCR.use_cassette('test_address_activation.yaml') def test_valid_email_is_valid(self):