diff options
| author | Barry Warsaw | 2010-02-24 12:46:12 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2010-02-24 12:46:12 -0500 |
| commit | e6f2ab3cbc90733ec0d12b833437f2f3a8cec4ed (patch) | |
| tree | eecbff313f4179b6cf40cae3199b215884a84ed3 /src/mailman/rest/docs | |
| parent | 34d4c62d414acbd7300efdb536070db3ac849979 (diff) | |
| download | mailman-e6f2ab3cbc90733ec0d12b833437f2f3a8cec4ed.tar.gz mailman-e6f2ab3cbc90733ec0d12b833437f2f3a8cec4ed.tar.zst mailman-e6f2ab3cbc90733ec0d12b833437f2f3a8cec4ed.zip | |
Complete the conversion to restish. All the tests pass and we're now actually
RESTful. We have to use httplib2 to get DELETE and PUT.
This is a prototype and could still use much cleanup.
Diffstat (limited to 'src/mailman/rest/docs')
| -rw-r--r-- | src/mailman/rest/docs/domains.txt | 7 | ||||
| -rw-r--r-- | src/mailman/rest/docs/lists.txt | 7 | ||||
| -rw-r--r-- | src/mailman/rest/docs/membership.txt | 64 |
3 files changed, 30 insertions, 48 deletions
diff --git a/src/mailman/rest/docs/domains.txt b/src/mailman/rest/docs/domains.txt index cbb9e9fce..0bce5fa54 100644 --- a/src/mailman/rest/docs/domains.txt +++ b/src/mailman/rest/docs/domains.txt @@ -121,14 +121,11 @@ But we get a 404 for a non-existent domain. Creating new domains ==================== -New domains can be created by posting to the 'domains' url. However -lazr.restful requires us to use a 'named operation' instead of posting -directly to the URL. +New domains can be created by posting to the 'domains' url. >>> dump_json('http://localhost:8001/3.0/domains', { ... 'email_host': 'lists.example.com', ... }) - URL: http://localhost:8001/3.0/domains content-length: 0 date: ... location: http://localhost:8001/3.0/domains/lists.example.com @@ -160,13 +157,11 @@ You can also create a new domain with a description, a base url, and a contact address. >>> dump_json('http://localhost:8001/3.0/domains', { - ... 'ws.op': 'new', ... 'email_host': 'my.example.com', ... 'description': 'My new domain', ... 'base_url': 'http://allmy.example.com', ... 'contact_address': 'helpme@example.com' ... }) - URL: http://localhost:8001/3.0/domains content-length: 0 date: ... location: http://localhost:8001/3.0/domains/my.example.com diff --git a/src/mailman/rest/docs/lists.txt b/src/mailman/rest/docs/lists.txt index bb0824f7a..ede0706fd 100644 --- a/src/mailman/rest/docs/lists.txt +++ b/src/mailman/rest/docs/lists.txt @@ -35,14 +35,11 @@ Creating lists via the API ========================== New mailing lists can also be created through the API, by posting to the -'lists' URL. However lazr.restful requires us to use a 'named operation' -instead of posting directly to the URL. +'lists' URL. >>> dump_json('http://localhost:8001/3.0/lists', { - ... 'ws.op': 'new', ... 'fqdn_listname': 'test-two@example.com', ... }) - URL: http://localhost:8001/3.0/lists content-length: 0 date: ... location: http://localhost:8001/3.0/lists/test-two@example.com @@ -74,7 +71,6 @@ However, you are not allowed to create a mailing list in a domain that does not exist. >>> dump_json('http://localhost:8001/3.0/lists', { - ... 'ws.op': 'new', ... 'fqdn_listname': 'test-three@example.org', ... }) Traceback (most recent call last): @@ -84,7 +80,6 @@ not exist. Nor can you create a mailing list that already exists. >>> dump_json('http://localhost:8001/3.0/lists', { - ... 'ws.op': 'new', ... 'fqdn_listname': 'test-one@example.com', ... }) Traceback (most recent call last): diff --git a/src/mailman/rest/docs/membership.txt b/src/mailman/rest/docs/membership.txt index f14bb0203..776713f5f 100644 --- a/src/mailman/rest/docs/membership.txt +++ b/src/mailman/rest/docs/membership.txt @@ -183,14 +183,14 @@ delivery. Since Elly's email address is not yet known to Mailman, a user is created for her. >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'join', ... 'fqdn_listname': 'alpha@example.com', ... 'address': 'eperson@example.com', ... 'real_name': 'Elly Person', ... }) - http_etag: ... - resource_type_link: http://localhost:8001/3.0/#member - self_link: http://localhost:8001/3.0/lists/alpha@example.com/member/eperson@example.com + content-length: 0 + date: ... + location: http://localhost:8001/3.0/lists/alpha@example.com/member/eperson@example.com + ... Elly is now a member of the mailing list. @@ -215,15 +215,16 @@ Leaving a mailing list ====================== Elly decides she does not want to be a member of the mailing list after all, -so she unsubscribes from the mailing list. +so she leaves from the mailing list. # Ensure our previous reads don't keep the database lock. >>> transaction.abort() - >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'leave', - ... 'fqdn_listname': 'alpha@example.com', - ... 'address': 'eperson@example.com', - ... }) + >>> dump_json('http://localhost:8001/3.0/lists/alpha@example.com' + ... '/member/eperson@example.com', + ... method='DELETE') + content-length: 0 + ... + status: 200 Elly is no longer a member of the mailing list. @@ -238,15 +239,16 @@ Fred joins the alpha mailing list but wants MIME digest delivery. >>> transaction.abort() >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'join', ... 'fqdn_listname': 'alpha@example.com', ... 'address': 'fperson@example.com', ... 'real_name': 'Fred Person', ... 'delivery_mode': 'mime_digests', ... }) - http_etag: ... - resource_type_link: http://localhost:8001/3.0/#member - self_link: http://localhost:8001/3.0/lists/alpha@example.com/member/fperson@example.com + content-length: 0 + ... + location: http://localhost:8001/3.0/lists/alpha@example.com/member/fperson@example.com + ... + status: 201 >>> fred = user_manager.get_user('fperson@example.com') >>> memberships = list(fred.memberships.members) @@ -263,7 +265,6 @@ Corner cases For some reason Elly tries to join a mailing list that does not exist. >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'join', ... 'fqdn_listname': 'beta@example.com', ... 'address': 'eperson@example.com', ... 'real_name': 'Elly Person', @@ -274,43 +275,35 @@ For some reason Elly tries to join a mailing list that does not exist. Then, she tries to leave a mailing list that does not exist. - >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'leave', - ... 'fqdn_listname': 'beta@example.com', - ... 'address': 'eperson@example.com', - ... 'real_name': 'Elly Person', - ... }) + >>> dump_json('http://localhost:8001/3.0/lists/beta@example.com' + ... '/members/eperson@example.com', + ... method='DELETE') Traceback (most recent call last): ... - HTTPError: HTTP Error 400: Bad Request + HTTPError: HTTP Error 404: Not Found She then tries to leave a mailing list with a bogus address. - >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'leave', - ... 'fqdn_listname': 'alpha@example.com', - ... 'address': 'elly', - ... }) + >>> dump_json('http://localhost:8001/3.0/lists/alpha@example.com' + ... '/members/elly', + ... method='DELETE') Traceback (most recent call last): ... - HTTPError: HTTP Error 400: Bad Request + HTTPError: HTTP Error 404: Not Found For some reason, Elly tries to leave the mailing list again, but she's already been unsubscribed. - >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'leave', - ... 'fqdn_listname': 'alpha@example.com', - ... 'address': 'eperson@example.com', - ... }) + >>> dump_json('http://localhost:8001/3.0/lists/alpha@example.com' + ... '/members/eperson@example.com', + ... method='DELETE') Traceback (most recent call last): ... - HTTPError: HTTP Error 400: Bad Request + HTTPError: HTTP Error 404: Not Found Anna tries to join a mailing list she's already a member of. >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'join', ... 'fqdn_listname': 'alpha@example.com', ... 'address': 'aperson@example.com', ... }) @@ -321,7 +314,6 @@ Anna tries to join a mailing list she's already a member of. Gwen tries to join the alpha mailing list using an invalid delivery mode. >>> dump_json('http://localhost:8001/3.0/members', { - ... 'ws.op': 'join', ... 'fqdn_listname': 'alpha@example.com', ... 'address': 'gperson@example.com', ... 'real_name': 'Gwen Person', |
